Here you can find the source of copyOfRange(int[] anArray, int from, int to)
public static int[] copyOfRange(int[] anArray, int from, int to)
//package com.java2s; public class Main { /**/*from w w w. j a v a 2 s. c om*/ * Returns a copy of given range of given array (this method is in Java 6 Arrays class). */ public static int[] copyOfRange(int[] anArray, int from, int to) { int newLength = to - from; if (newLength < 0) throw new IllegalArgumentException(from + " > " + to); int[] copy = new int[newLength]; System.arraycopy(anArray, from, copy, 0, Math.min(anArray.length - from, newLength)); return copy; } }