Java Utililty Methods Array Clone

List of utility methods to do Array Clone

Description

The list of methods to do Array Clone are organized into topic(s).

Method

String[]clone(String[] array)
Clones an array returning a typecast result and handling null.
if (array == null) {
    return null;
return array.clone();
T[]clone(T[] array)
clone
if (array == null) {
    return null;
return array.clone();
T[]clone(T[] array)
clone not supported on arrays by gwt
return array.clone();
T[]clone(T[] array)
clone
if (array == null) {
    return null;
return array.clone();
double[][]clone2DArray(double[][] a)
Clones a two-dimensional matrix.
if (a == null)
    return null;
double[][] copy = new double[a.length][a.length == 0 ? 0 : a[0].length];
for (int i = 0; i < a.length; i++) {
    System.arraycopy(a[i], 0, copy[i], 0, a[i].length);
return copy;
Double[][]clone2DArray(Double[][] array)
Clones a 2D Double Array
Double[][] new_array = new Double[array.length][array[0].length];
for (int i = 0; i < array.length; i++) {
    for (int j = 0; j < array.length; j++) {
        new_array[i][j] = new Double(array[i][j]);
return new_array;
double[][]clone2dArray(double[][] myArray)
cloned Array
double[][] arrayCopy = new double[myArray.length][];
for (int i = 0; i < myArray.length; i++) {
    arrayCopy[i] = myArray[i].clone();
return arrayCopy;
boolean[][]clone2DArray(final boolean[][] array)
Creates an independent copy of the boolean array.
final int rows = array.length;
final boolean[][] newArray = array.clone();
for (int row = 0; row < rows; row++) {
    newArray[row] = array[row].clone();
return newArray;
float[][]clone_multidim_array(float[][] arr)
copies a 2D float array
float[][] temp = new float[arr.length][];
for (int i = 0; i < arr.length; i++) {
    temp[i] = arr[i].clone();
return temp;
float[]cloneAndMultiplyArray(float[] array, float factor)
clone And Multiply Array
float[] result = new float[array.length];
for (int i = 0; i < array.length; ++i) {
    result[i] = array[i] * factor;
return result;