Here you can find the source of copyBytes(byte[] data, int from, int to)
Parameter | Description |
---|---|
data | - The array from which a range is to be copied |
from | - The initial index of the range to be copied, inclusive |
to | - The final index of the range to be copied, exclusive. (This index may lie outside the array.) |
public static byte[] copyBytes(byte[] data, int from, int to)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; public class Main { /**// w w w .ja v a 2s .co m * To copy the range of the data bytes from the data. * * @param data - The array from which a range is to be copied * @param from - The initial index of the range to be copied, inclusive * @param to - The final index of the range to be copied, exclusive. (This index may lie outside the array.) * * @return A byte buffer. * * @author Tzyy Tong * @since 01-03-2013 * */ public static byte[] copyBytes(byte[] data, int from, int to) { return Arrays.copyOfRange(data, from, to); } }