code: public static byte[] copyOf(byte[] src, int length) {
          byte[] dest = new byte[length];
          System.arraycopy(src, 0, dest, 0, Math.min(src.length, length));
          return dest;
      }
docs: byte array copy.
  
  @param src    src.
  @param length new length.
  @return new byte array.