Here you can find the source of cloneIntArray(int array[])
Parameter | Description |
---|---|
array | The array to be cloned |
public static int[] cloneIntArray(int array[])
//package com.java2s; // it under the terms of the GNU General Public License as published by public class Main { /**/*from w w w. ja va 2 s . c o m*/ * Clone an integer array. * @param array The array to be cloned * @return The new array */ public static int[] cloneIntArray(int array[]) { int i, n; int[] arrayNew; // Do nothing for null pointers if (array == null) return null; // Otherwise copy and return n = array.length; arrayNew = new int[n]; for (i = 0; i < n; i++) { arrayNew[i] = array[i]; } return arrayNew; } }