直接选择排序算法例子。 class SelectSort{ public void sort(int[] array){ int temp,pos; for(int i=0,length=array.length;i<length;i++){ pos=i; for(int j=i+1;j<length;j++){ if(array[j]<array[i]){ pos=j; if(pos!=i){ temp=array[pos]; array[pos]=array[i]; array[i]=temp; } } } } } }