Java tutorial
//package com.java2s; import java.lang.reflect.Array; public class Main { /** * Returns a duplicates of an array. */ public static Object duplicateArray(Object source) { int size = Array.getLength(source); Object newarray = Array.newInstance(source.getClass().getComponentType(), size); System.arraycopy(source, 0, newarray, 0, size); return newarray; } }