Here you can find the source of copyOf(int[] arr, int length)
public static int[] copyOf(int[] arr, int length)
//package com.java2s; // it under the terms of the GNU General Public License as published by // public class Main { public static int[] copyOf(int[] arr, int length) { int[] copy = new int[arr.length]; System.arraycopy(arr, 0, copy, 0, length); return copy; }/*www. ja va 2s. c om*/ public static double[][] copyOf(double[][] arr) { double[][] copy = new double[arr.length][arr[0].length]; for (int i = 0; i < arr.length; i++) { System.arraycopy(arr[i], 0, copy[i], 0, arr[0].length); } return copy; } }