public static Object arrayGrow(Object obj,int addlength){
Class c = obj.getClass();
if(!c.isArray()){
return null;
}
Class type = c.getComponentType();
int length = Array.getLength(obj);
int newlength = length+addlength;
Object newArray = Array.newInstance(type, newlength);
System.arraycopy(obj, 0, newArray, 0, length);
return newArray;
}
浙公网安备 33010602011771号