http://kb.cnblogs.com/page/176818/

 

package primary;

public class SimplySelectSort {
    public static void main(String[] args){
        int[] array = {2,6,1,9,4,3,23,65,0,7};
        System.out.print("the array before is:");
        for(int i = 0; i <array.length; i++){
            System.out.print(array[i]+"  ");
        }
        System.out.println(" ");
        simplySelectSort(array);
    }
    protected static void simplySelectSort(int[] array){
        int len = array.length;
        for(int i = 0; i < len; i++){
            for(int j = i; j < len; j++){
                if(array[j] < array[i]){
                    int temp = array[j];
                    array[j] = array[i];
                    array[i] = temp;
                }
            }
        }
        for(int z = 0; z < len; z++){
            System.out.print(array[z]+"  ");
        }
    }
}

 

相关文章:

  • 2021-07-05
  • 2021-10-28
  • 2021-10-06
  • 2021-05-25
  • 2022-02-03
  • 2022-12-23
  • 2022-01-12
猜你喜欢
  • 2021-08-19
  • 2022-12-23
  • 2021-10-15
  • 2021-09-03
  • 2022-12-23
  • 2021-05-13
  • 2022-12-23
相关资源
相似解决方案