冒泡排序一组随机数

public class Bubble {
    public void orderBynothing(){
        int arr1[] = new int[200];
        for (int x = 0; xarr1[j]){
                    int re = arr1[i];
                    arr1[i] = arr1[j];
                    arr1[j] = re;
                }
            }
        }
        for (int z:arr1) {
            System.out.println(z);
        }
    }

    public static void main(String []args){
        Bubble b = new Bubble();
        b.orderBynothing();
    }
}
第一个for循环是给arr1数组赋值,第二个是冒泡排序,第三个是输出

你可能感兴趣的:(java)