byte[] abyte = new byte(abyte1.length + abyte2.length);
int i = 0;
int j = 0;
for(;i<abyte1.length;i++)
abyte[i] = abyte1[i];for(;j<abyte2.length;j++)
abyte[i+j] = abyte2[j];
int i = 0;
int j = 0;
for(;i<abyte1.length;i++)
abyte[i] = abyte1[i];for(;j<abyte2.length;j++)
abyte[i+j] = abyte2[j];
System.arraycopy(abyte1,0,abyte,0,abyte1.lenth);
System.arraycopy(abyte2,0,abyte,abyte1.length,abyte2.length).查一下jdk帮助,看看arraycopy,注意源和目的的顺序。
public static void arraycopy(Object src,
int srcPos,
Object dest,
int destPos,
int length)