使用Java进行冒泡排序

import java.util.Arrays;

public class BubbleSort {
    public static void main(String[] args) {
        int[] arr = {3, 2, 1, 8, 6, 9, 7, 0, 5, 4};
        Arrays.stream(bubbleSort(arr)).forEach(e -> System.out.println(e));
    }

    public static int[] bubbleSort(int[] arr) {
        for(int i=arr.length-1; i>0; i--) {
            for(int j=0;j<i;j++) {
                if(arr[j] > arr[j+1]) {
                    int tmp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = tmp;
                }
            }
        }
        return arr;
    }
}