Data operation related function notes
1, array replication function
System.ArrayCopy ()
System.ArrayCopy (source array, 0, target array, 0, copy length)
Example:
Public Class Testarrcopy
{
Public static void main (string [] args)
{
INT IA [] = new int {1, 2, 3, 4, 5};
INT IB [] = new int {9, 8, 7, 6, 5, 4, 3, 2};
System.ArrayCopy (IA, 0, IB, 0, 3);
// Copy the three elements from the subscript 0 to the array IB from the subscript 0 and start storage from the subscript 0
For (int i = 0; i System.out.print (IA [i]); For (int J = 0; j System.out.print (IB [J]); } } Results: 1234512365432 2, array sort function Arrays.sort (array name) Sample program: Import java.util. *; Class Arrsort { Public static void main (string [] args) { INT IA [] = new int {2, 9, 3, 6, 7, 4}; Arrays.Sort (IA); For (int i = 0; i System.out.print (IA [i]); } } Results: 234679 3, array comparison function (not element comparison) Arrays.equals (array 1, array 2) Sample program: Import java.util. *; Class EQU { Public static void main (string [] args) { INT IA [] = new int {1,2}; INT IB [] = new int in {1, 2}; IF (Arrays.Equals (IA, IB)) System.out.println ("IA [] Equals IB []"); Else System.out.println ("IA [] NOT Equals IB []"); } } Result: IA [] Equals IB []