public static byte [ ] copyOf ( byte [ ] b , int off , int len ) throws NullPointerException , ArrayIndexOutOfBoundsException { if ( b == null ) { throw new NullPointerException ( ) ; } if ( off < 0 || len < 0 || off > b . length - len ) { throw new ArrayIndexOutOfBoundsException ( ) ; } byte [ ] copy = new byte [ len ] ; System . arraycopy ( b , off , copy , 0 , len ) ; return copy ; }
Creates a copy of a section of the given byte array .