Here you can find the source of subArray(byte[] byteArray, int beginIndex, int length)
Parameter | Description |
---|---|
byteArray | The byte array. Must not be null . |
beginIndex | The beginning index, inclusive. Must be zero or positive. |
length | The length. Must be zero or positive. |
public static byte[] subArray(byte[] byteArray, int beginIndex, int length)
//package com.java2s; //License from project: Apache License public class Main { /**// ww w .j a v a 2s. c o m * Returns a portion of the specified byte array. * * @param byteArray The byte array. Must not be {@code null}. * @param beginIndex The beginning index, inclusive. Must be zero or * positive. * @param length The length. Must be zero or positive. * * @return The byte array portion. */ public static byte[] subArray(byte[] byteArray, int beginIndex, int length) { byte[] subArray = new byte[length]; System.arraycopy(byteArray, beginIndex, subArray, 0, subArray.length); return subArray; } }