Here you can find the source of deepCopy(Object objectArray)
public static <T> T deepCopy(Object objectArray)
//package com.java2s; //License from project: Apache License import java.util.Arrays; public class Main { public static <T> T deepCopy(Object objectArray) { Class arrayClass = objectArray.getClass(); if (boolean[].class.equals(arrayClass)) { boolean[] array = (boolean[]) objectArray; return (T) Arrays.copyOf(array, array.length); } else if (byte[].class.equals(arrayClass)) { byte[] array = (byte[]) objectArray; return (T) Arrays.copyOf(array, array.length); } else if (short[].class.equals(arrayClass)) { short[] array = (short[]) objectArray; return (T) Arrays.copyOf(array, array.length); } else if (int[].class.equals(arrayClass)) { int[] array = (int[]) objectArray; return (T) Arrays.copyOf(array, array.length); } else if (long[].class.equals(arrayClass)) { long[] array = (long[]) objectArray; return (T) Arrays.copyOf(array, array.length); } else if (float[].class.equals(arrayClass)) { float[] array = (float[]) objectArray; return (T) Arrays.copyOf(array, array.length); } else if (double[].class.equals(arrayClass)) { double[] array = (double[]) objectArray; return (T) Arrays.copyOf(array, array.length); } else if (char[].class.equals(arrayClass)) { char[] array = (char[]) objectArray; return (T) Arrays.copyOf(array, array.length); } else {/* w ww .ja va 2 s . co m*/ Object[] array = (Object[]) objectArray; return (T) Arrays.copyOf(array, array.length); } } }