Java Array Copy copyBytes(byte[] data, int from, int to)

Here you can find the source of copyBytes(byte[] data, int from, int to)

Description

To copy the range of the data bytes from the data.

License

Open Source License

Parameter

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.)

Return

A byte buffer.

Declaration

public static byte[] copyBytes(byte[] data, int from, int to) 

Method Source Code

//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);
    }
}

Related

  1. copyArrayRange(final byte[] value, int start, int end)
  2. copyArrays(byte[] dest, byte[] source, int fromIdx)
  3. copyArrays(byte[] src, int srcOffset, byte[] dst, int dstOffset, int numBytes)
  4. copyArrayToStr(String[] src, String del)
  5. copyArrayWhenNotNull(byte[] source)
  6. copyExcept(E[] orig, E excludedElem)
  7. copyIfExceeded(int[] arr, int len)
  8. copyIntoBigger(int[] array, int newSize, int defaultValue)
  9. copyOf(boolean[] t)