Here you can find the source of subArray(byte[] data, int offset, int length)
Parameter | Description |
---|---|
data | Array of bytes. |
offset | First byte of subarray in original array. |
length | Length of subarray. |
public static byte[] subArray(byte[] data, int offset, int length)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . j a v a 2s .c om*/ * Returns subarray of bytes. * * @param data Array of bytes. * @param offset First byte of subarray in original array. * @param length Length of subarray. * @return Array of bytes representing the subarray. */ public static byte[] subArray(byte[] data, int offset, int length) { byte[] subarray = new byte[length]; System.arraycopy(data, offset, subarray, 0, length); return subarray; } }