public static byte[] concatenate(byte[] a,byte[] b){
  int lengthA=a.length;
  int lengthB=b.length;
  byte[] concat=new byte[lengthA + lengthB];
  System.arraycopy(a,0,concat,0,lengthA);
  System.arraycopy(b,0,concat,lengthA,lengthB);
  return concat;
}

public static byte [ ] concatenate ( byte [ ] a , byte [ ] b ) { int lengthA = a . length ; int lengthB = b . length ; byte [ ] concat = new byte [ lengthA + lengthB ] ; System . arraycopy ( a , 0 , concat , 0 , lengthA ) ; System . arraycopy ( b , 0 , concat , lengthA , lengthB ) ; return concat ; }
concatenates two byte arrays .
