Code:
Package COM. xu. main; public class p11_1 {static final int size = 10; public static void selectsort (int A []) {int index, temp; For (INT I = 0; I <. length; I ++) {Index = I; for (Int J = I + 1; j <. length; j ++) {if (a [J] <A [Index]) {Index = J ;}// exchange two numbers if (index! = I) {temp = A [I]; A [I] = A [Index]; A [Index] = temp;} system. out. print ("+ I +" Step sorting result: "); For (INT h = 0; H <. length; H ++) {system. out. print ("" + A [H]);} system. out. println () ;}} public static void main (string [] ARGs) {int [] shuzu = new int [size]; int I; for (I = 0; I <size; I ++) {shuzu [I] = (INT) (100 + math. random () * (100 + 1);} system. out. println ("the array before sorting is:"); for (I = 0; I <size; I ++) {system. out. print (shuzu [I] + "");} system. out. println (); selectsort (shuzu); system. out. println ("the sorted array is:"); for (I = 0; I <size; I ++) {system. out. print (shuzu [I] + "");} system. out. println ();}}
Running result: