Skip to content

Commit 03077dc

Browse files
author
crazy
committed
我也不知道是什么
1 parent 429c844 commit 03077dc

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.xinan.array;
2+
3+
import java.util.Arrays;
4+
5+
public class TestJavasort {
6+
7+
public static void main(String[] args) {
8+
// TODO Auto-generated method stub
9+
int[] a = { 4, 7, 3, 6, 4 };
10+
System.out.println("数组排序前:");
11+
for (int i = 0; i < a.length; i++) {
12+
System.out.println(a[i] + "");
13+
}
14+
Arrays.sort(a);
15+
System.out.println("排序之后的顺序:");
16+
for (int i = 0; i < a.length; i++) {
17+
System.out.println(a[i]+"");
18+
/* System.out.println(a[a.length-i-1] + "");可以实现倒序输出 */
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)