public static byte[] joinArrays(byte[]... args) {
byte[] result = null;
if(args.length > 0) {
result = args[0];
for(int index = 1; index < args.length; index++){
result = concat(result, args[index]);
}
}
return result;
}
public static byte[] concat(byte[] a, byte[] b) {
int aLen = a.length;
int bLen = b.length;
byte[] c= new byte[aLen+bLen];
System.arraycopy(a, 0, c, 0, aLen);
System.arraycopy(b, 0, c, aLen, bLen);
return c;
}