62,634
社区成员




Animal[] copy = new Animal[animals.length+1];
System.arraycopy(animals, 0, copy, 0, animals.length);
copy[copy.length-1] = animal;
return copy;
public static <T,U> T[] copyOf(U[] original, int newLength, Class<? extends T[]> newType) {
T[] copy = ((Object)newType == (Object)Object[].class)
? (T[]) new Object[newLength]
: (T[]) Array.newInstance(newType.getComponentType(), newLength);
System.arraycopy(original, 0, copy, 0,
Math.min(original.length, newLength));
return copy;
}