标签:技术 rgs java blog info mamicode ring print void
package blog;
import java.util.Arrays;
public class bubble {
public static void main(String[] args) {
int[] a = new int[] {9,5,7,4,0,3};
asc(a);
System.out.println(Arrays.toString(a));
}
static void asc(int [] arr) {
int temp;
for(int i=0;i<arr.length-1;i++) {
for(int j=0;j<arr.length-1-i;j++) {
if(arr[j+1] < arr[j]) {
temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
}
}
标签:技术 rgs java blog info mamicode ring print void
原文地址:https://www.cnblogs.com/wangsihui/p/11877106.html