/*给定一个整型数组,数组成员,将数组逆序排列*/
//选择排序
public class Tryshuzu {
public static void shuZu(int[] arr) {
for (int m = 0; m < arr.length - 1; m++) {
for (int n = m + 1; n < arr.length; n++) {
if (arr[m] < arr[n]) {
int temp = arr[m];
arr[m] = arr[n];
arr[n] = temp;
}
}
}
}
public static void main(String[] args) {
int[] arr = new int[] { 5, 6, 4, 9, 3 };
shuZu(arr);
System.out.println("确定排序为:");
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + "\t");
}
}
}