/**
*
* 选择排序算法~~~
*/
public class test {
public static void main(String args[]) {
int arrayA[] = {1, 5, 4, 23, 8, 6, 7, 9, 16, 32};
int[] arrayB = sort(arrayA);
for (int i = 0; i < arrayB.length; i++) {
System.out.println(arrayB[i]);
}
}
public static int[] sort(int[] a) {
for (int i = 0; i < a.length - 1; i++) {
int k = i;
for (int j = i + 1; j < a.length; j++) {
if (a[k] > a[j]) {
k = j;
}
}
if (i != k) {
int temp = a[i];
a[i] = a[k];
a[k] = temp;
}
}
return a;
}
}