code: 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;
      }
docs: Creates a copy of a section of the given byte array.
  
  @param b
  the array to copy.
  @param off
  the start offset of the data within {@code b}.
  @param len
  the number of bytes to copy.
  
  @return The copy of the requested section of {@code b}.
  
  @throws NullPointerException
  if {@code b} is null.
  @throws ArrayIndexOutOfBoundsException
  if the half-range {@code [off..off+len)} is not in {@code [0..b.length)}.