java版冒泡排序
public class buBBle {
public static void main(String[] args) {
int arr[] = {22,1,10,222,33,27,909};
for (int i = 0; i < arr.length-1; i++) {
for (int j = 0; j < arr.length-1-i; j++) {
if(arr[j] < arr[j+1]){
int temp = arr[j+1];
arr[j+1] = arr[j];
arr[j] = temp;
}
}
}
for (int b = 0; b < arr.length; b++) {
System.o
java版冒泡排序最先出现在Python成神之路。
共有 0 条评论