一、for循环逐一复制;数据多的时候,复制速度会变慢。源码
二、System.arraycopy()方法:效率最好for循环
三、Arrays.copyOf()方法:源码以下效率
public static byte[] copyOf(byte[] original, int newLength) {
byte[] copy = new byte[newLength];
System.arraycopy(original, 0, copy, 0,
Math.min(original.length, newLength));
return copy;
}循环
四、clone()方法:效率最差方法