This article and you share another array of operations methods--sort methods to sort the arrays.
Example: Testjava4_5.java
01//The following program is an array of sort operations, where the sort method is used to sort the arrays
java.util.* import;
public class Testjava4_5
04 {
public static void Main (string[] args)
06 {
-int a[] = {4,32,45,32,65,32,2};
08
System.out.print ("Order of the array before sorting:");
Ten for (int i=0;i<a.length;i++)
One System.out.print (a[i]+ "");
Arrays.sort (a); Sorting Methods for arrays
System.out.print ("\ n the order of the array after sorting:");
+ for (int i=0;i<a.length;i++)
System.out.print (a[i]+ "");
16}
17}
Output Result:
Order of array before sorting: 4 32 45 32 65 32 2
Order of the array after sorting: 2 4 32 32 32 45 65
The 12th line of the program Arrays.sort (array name) array of operations, but this method in Java.util this package, so in the use of the time need to import it, about the concept of the package, the small part will be in the future sharing with everyone to learn. As I said before, the current study may encounter some problems can not be fully understood, do not go into a dead end, or it will hinder everyone's learning progress, beginners in contact with Java by constantly knocking code, like "book read times, its righteousness from the present" the same truth.