Here you can find the source of copyOfRange(int[] old, int from, int to)
public static int[] copyOfRange(int[] old, int from, int to)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww. ja v a 2 s .c o m * Identical to {@code Arrays.copyOfRange}, but GWT compatible. */ public static int[] copyOfRange(int[] old, int from, int to) { int length = to - from; int[] newArray = new int[length]; int minLength = Math.min(old.length - from, length); System.arraycopy(old, from, newArray, 0, minLength); return newArray; } /** * Identical to {@code Arrays.copyOfRange}, but GWT compatible. */ public static long[] copyOfRange(long[] old, int from, int to) { int length = to - from; long[] newArray = new long[length]; int minLength = Math.min(old.length - from, length); System.arraycopy(old, from, newArray, 0, minLength); return newArray; } /** * Identical to {@code Arrays.copyOfRange}, but GWT compatible. */ public static double[] copyOfRange(double[] old, int from, int to) { int length = to - from; double[] newArray = new double[length]; int minLength = Math.min(old.length - from, length); System.arraycopy(old, from, newArray, 0, minLength); return newArray; } /** * Identical to {@code Arrays.copyOfRange}, but GWT compatible. */ public static String[] copyOfRange(String[] old, int from, int to) { int length = to - from; String[] newArray = new String[length]; int minLength = Math.min(old.length - from, length); System.arraycopy(old, from, newArray, 0, minLength); return newArray; } }