Welcome to Yumao′s Blog.
/**冒泡排序*/
import java.util.Arrays;
public class Maopao {
public static void main(String[] args){
int[] a = {4,2,5,7,1};
int x =0;
for(int i=0;ia[j+1]){
x=a[j];
a[j]=a[j+1];
a[j+1]=x;
}
}
}
System.out.println(Arrays.toString(a));
}
}