system.arraycopy () source code. You can see the native method:The native keyword indicates that its modification is a primitive method, and the corresponding implementation of the method is not in the current file, but in a file implemented in other languages, such as C and C + +. The native method can be likened to a Java program's interface to a C program.
Public Static native void arraycopy (Object src, int srcpos, int destpos,int
CopyOf, the following is the source code, you can see the Arraycopy method is essentially called. , then its efficiency must be inferior to Arraycopy's
Public Static int [] copyOf (intint newlength) { intnewint[newlength] ; 0, copy, 0, math.min (Original.length, newlength)); return copy;}
The specific reason is not good to say. But the consistent argument and experiment proved to be arraycopy () high efficiency!!! T... T
JAVA System.arraycopy and arrays.copyof efficiency comparison