Here you can find the source of subArray(byte[] array, int beginIndex, int endIndex)
Parameter | Description |
---|---|
array | the byte array to extract from |
beginIndex | the beginning index of the sub array, inclusive |
endIndex | the ending index of the sub array, exclusive |
public static byte[] subArray(byte[] array, int beginIndex, int endIndex)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w. j av a 2s.co m * Extract a sub array of bytes out of the byte array. * @param array the byte array to extract from * @param beginIndex the beginning index of the sub array, inclusive * @param endIndex the ending index of the sub array, exclusive */ public static byte[] subArray(byte[] array, int beginIndex, int endIndex) { int length = endIndex - beginIndex; byte[] subarray = new byte[length]; System.arraycopy(array, beginIndex, subarray, 0, length); return subarray; } }