克隆数组的泛型方法
/*NowJava.com - 时代Java 提供*/ //package com.nowjava; import java.lang.reflect.Array; public class Main { public static <T> T[] clone_array(T[] array, Class<T> cls) throws Exception { T[] copy = (T[]) Array.newInstance(cls, array.length); for (int i = 0; i < array.length; i++) { copy[i] = array[i]; } return copy; } }