package com.lovcoding.day06;

import java.util.Arrays;

public class TestArr04_Sort_2 {
    //选择排序
    public static void main(String[] args) {
        int[] arr = {11,31,53,16,18,1,1231,123,123,432,5,32,5,435,4326,456,45,1,123,213,213,12,4,21,4,21,4,214,21,4,21,4,21};
        long start = System.currentTimeMillis();

        for (int i = 1; i < arr.length; i++) {
            for (int j = 0; j < arr.length-i; j++) {
                //第一个和第二个比较
                if (arr[j] > arr[j+1]){
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }

        long end = System.currentTimeMillis();
        System.out.println(end-start);

        System.out.println(Arrays.toString(arr));
    }
}
