Auto commit

上级 5b0ce43e
import java.util.Arrays;
class Main { class Main {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("Hello world!");
int[] arr ={3333,22,54,990,234,2322,99,553,3333};
bubbleSort(arr);
System.out.println(Arrays.toString(arr));
} }
}
\ No newline at end of file
public static void bubbleSort(int[] arr) {
int n = arr.length;
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册