Here you can find the source of copyOf(byte[] bytes)
public static byte[] copyOf(byte[] bytes)
//package com.java2s; /**//from w w w . j av a2 s . c o m * Source obtained from crypto-gwt. Apache 2 License. * https://code.google.com/p/crypto-gwt/source/browse/crypto-gwt/src/main/java/com/googlecode/ * cryptogwt/util/ByteArrayUtils.java */ public class Main { public static byte[] copyOf(byte[] bytes) { return copyOfRange(bytes, 0, bytes.length); } public static byte[] copyOfRange(byte[] bytes, int offset, int len) { byte[] result = new byte[len]; System.arraycopy(bytes, offset, result, 0, len); return result; } }