public static byte[][] split(final byte[] bytes,final int splitIndex){
  if (splitIndex < 0 || bytes.length < splitIndex) {
    throw new IllegalArgumentException("split index is out of range");
  }
  final byte[] lhs=new byte[splitIndex];
  final byte[] rhs=new byte[bytes.length - splitIndex];
  System.arraycopy(bytes,0,lhs,0,lhs.length);
  System.arraycopy(bytes,splitIndex,rhs,0,rhs.length);
  return new byte[][]{lhs,rhs};
}

public static byte [ ] [ ] split ( final byte [ ] bytes , final int splitIndex ) { if ( splitIndex < 0 || bytes . length < splitIndex ) { throw new IllegalArgumentException ( "split index is out of range" ) ; } final byte [ ] lhs = new byte [ splitIndex ] ; final byte [ ] rhs = new byte [ bytes . length - splitIndex ] ; System . arraycopy ( bytes , 0 , lhs , 0 , lhs . length ) ; System . arraycopy ( bytes , splitIndex , rhs , 0 , rhs . length ) ; return new byte [ ] [ ] { lhs , rhs } ; }
splits a single array into two arrays .
