I wrote the following procedure for concatenation of several array:
static public byte[] concat(byte[]... bufs) {
if (bufs.length == 0)
return null;
if (bufs.length == 1)
return bufs[0];
for (int i = 0; i < bufs.length - 1; i++) {
byte[] res = Arrays.copyOf(bufs[i], bufs[i].length+bufs[i + 1].length);
System.arraycopy(bufs[i + 1], 0, res, bufs[i].length, bufs[i + 1].length);
bufs[i + 1] = res;
}
return bufs[bufs.length - 1];
}
It uses Arrays.copyOf