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

boolean[][]cloneArray(boolean[][] src)
clone Array
int length = src.length;
boolean[][] target = new boolean[length][src[0].length];
for (int i = 0; i < length; i++) {
    System.arraycopy(src[i], 0, target[i], 0, src[i].length);
return target;
byte[]cloneArray(byte[] bytes)
Returns null if given null, or clones into a new array only if not empty.
return (bytes == null || bytes.length == 0) ? bytes : bytes.clone();
byte[]cloneArray(byte[] in)
Clone a byte array.
if (in == null) {
    throw new NullPointerException("in == null");
byte[] out = new byte[in.length];
System.arraycopy(in, 0, out, 0, in.length);
return out;
double[][]cloneArray(double[][] a)
_more_
double[][] b = new double[a.length][a[0].length];
for (int i = 0; i < a.length; i++) {
    System.arraycopy(a[i], 0, b[i], 0, a[0].length);
return b;
Double[][]cloneArray(Double[][] src)
clone Array
int length = src.length;
Double[][] target = new Double[length][src[0].length];
for (int i = 0; i < length; i++) {
    System.arraycopy(src[i], 0, target[i], 0, src[i].length);
return target;
String[]cloneArray(final String[] inputArray)
To make the clone copy of the given String array.
final String[] array = new String[inputArray.length];
System.arraycopy(inputArray, 0, array, 0, inputArray.length);
return array;
int[]cloneArray(int[] array)
Creates a copy of string array.
if (array == null)
    return null;
int[] a = new int[array.length];
for (int i = 0; i < array.length; i++) {
    a[i] = array[i];
return a;
int[]clonearray(int[] clonethis)
clonearray
int[] result = new int[clonethis.length];
for (int i = 0; i < clonethis.length; i++)
    result[i] = clonethis[i];
return result;
int[]cloneArray(int[] src)
clone Array
return (int[]) src.clone();
String[]cloneArray(String[] orArray, int from)
clone Array
return cloneArray(orArray, from, orArray.length);