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

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

Description

copy Of Range

License

Apache License

Declaration

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

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static byte[] copyOfRange(byte[] original, int from, int to) {
        if (from >= original.length || to > original.length || to <= from) {
            return null;
        }/*  ww w.  j  av  a  2  s .c  o  m*/
        int newLength = to - from;
        byte[] copy = new byte[newLength];
        System.arraycopy(original, from, copy, 0, newLength);
        return copy;
    }
}

Related

  1. copyOf(T[] oriArray, int newArraySize, int startOffset)
  2. copyOfArray(int[] a)
  3. copyOfRange(byte[] bytes, int offset, int len)
  4. copyOfRange(byte[] original, int from, int to)
  5. copyOfRange(byte[] original, int from, int to)
  6. copyOfRange(byte[] original, int from, int to)
  7. copyOfRange(byte[] original, int from, int to)
  8. copyOfRange(char[] original, int from, int to)
  9. copyOfRange(final byte[] array, final int startIndex, final int endIndex)