Here you can find the source of copy(int[] array)
public static int[] copy(int[] array)
//package com.java2s; //License from project: Apache License import java.util.Arrays; public class Main { /**/*www . j a v a2s . c om*/ * Copies the given array into a new one. */ public static int[] copy(int[] array) { int[] newInt = new int[array.length]; System.arraycopy(array, 0, newInt, 0, array.length); return newInt; } /** * Copies the given array into a new one. */ public static double[] copy(double[] array) { double[] newInt = new double[array.length]; System.arraycopy(array, 0, newInt, 0, array.length); return newInt; } /** * Copies the given array into a new one. */ public static long[] copy(long[] array) { long[] newInt = new long[array.length]; System.arraycopy(array, 0, newInt, 0, array.length); return newInt; } /** * Copies the given array into a new one. */ public static <T> T[] copy(T[] array) { return Arrays.copyOf(array, array.length); } }