Here you can find the source of copyOf(byte[] src, int length)
Parameter | Description |
---|---|
src | src. |
length | new length. |
public static byte[] copyOf(byte[] src, int length)
//package com.java2s; //License from project: Apache License public class Main { /**/* w w w . j a v a 2 s . co m*/ * byte array copy. * * @param src src. * @param length new length. * @return new byte array. */ public static byte[] copyOf(byte[] src, int length) { return copyOf(src, 0, length); } /** * byte array copy. * * @param src * @param offset * @param length * @return */ public static byte[] copyOf(byte[] src, int offset, int length) { byte[] dest = new byte[length]; System.arraycopy(src, offset, dest, 0, length); return dest; } }