This refers to the high, not too tall, but that we can call the system functions, directly to the array copy, and the power of the function is not limited to the replication of the array, and can intercept the array, insert or delete an element at the specified location.
This article only describes the copying of arrays, and other operations will be elaborated in subsequent articles.
Copy an array to another array, using the
System.arrycopy ()
Parameter description of the method:
System.arrycopy (From,fromstart,to,tostart,count)
1 //Copy the value of a array into the B array2 3 Public classtest44 {5 Public Static voidmain (String [] args)6 {7 int[] A = {1,2,3,4,5};8 9 int[] arr2 =New int[arr1.length];Ten OneSystem.arrycopy (arr1,0,arr2,0, arr1.length); A -ARR2[2] = 10; - the for(intnum:arr1) - { - //Printed Results: 1 2 3 4 5 -System.out.print (num+ "\ T"); + } - + System.out.println (); A at for(intnum:arr2) - { - //Printed Result: 1 2 4 5 -System.out.print (num+ "\ T"); - } - } in}
Replication of advanced Arrays (Test4.java)