- mport java.util.Arrays;
- public class ch40
- {
- public static void main(String args[])
- {
- int n[]={56,45,44,464,6,4,6,4,646,,48,4,874,48,1,646,4,6,4,46};
- System.out.println("排序前: ");
- for(int i=0; i<n.length; i++)
- System.out.print(n[i]+" ");
- System.out.println();
- Arrays.sort(n);
- System.out.println("排序後: ");
- for(int i=0; i<n.length; i++)
- System.out.print(n[i]+" ");
- System.out.println();
- }
- }
複製代碼 |