Java Array Range Copy copyOfRange(final byte[] original, final int from, final int to)

Here you can find the source of copyOfRange(final byte[] original, final int from, final int to)

Description

copy Of Range

License

Open Source License

Declaration

public static byte[] copyOfRange(final byte[] original, final int from, final int to) 

Method Source Code

//package com.java2s;

public class Main {
    public static byte[] copyOfRange(final byte[] original, final int from, final int to) {
        final int newLength = to - from;
        if (newLength < 0) {
            throw new IllegalArgumentException(from + " > " + to);
        }//w w w  .j ava2s  . c  o m
        final byte[] copy = new byte[newLength];
        System.arraycopy(original, from, copy, 0, Math.min(original.length - from, newLength));
        return copy;
    }
}

Related

  1. copyOfRange(byte[] original, int from, int to)
  2. copyOfRange(byte[] original, int from, int to)
  3. copyOfRange(byte[] original, int from, int to)
  4. copyOfRange(char[] original, int from, int to)
  5. copyOfRange(final byte[] array, final int startIndex, final int endIndex)
  6. copyOfRange(final double[] data, final int start, final int end)
  7. copyOfRange(int[] anArray, int from, int to)
  8. copyOfRange(int[] old, int from, int to)
  9. copyOfRange(int[] original, int from, int to)