Here you can find the source of copyOf(byte[] original, int newLength)
Parameter | Description |
---|---|
original | original byte array |
newLength | new length |
private static byte[] copyOf(byte[] original, int newLength)
//package com.java2s; public class Main { /**//from w w w .ja v a2 s .com * Implementation of JDK 1.6 Arrays.copyOf() method * * @param original original byte array * @param newLength new length * @return new allocated byte array */ private static byte[] copyOf(byte[] original, int newLength) { byte[] copy = new byte[newLength]; System.arraycopy(original, 0, copy, 0, Math.min(original.length, newLength)); return copy; } }