标签:++ ble class rgs ring 循环 code stat color
import java.util.*; public class Bubble { public static void main(String[] args){ int[] a={5,6,1,89,3,98,4}; //外层循环;回合数; for (int i=1;i<a.length ;i++ ) { int temp=a[i]; //存储要插入的元素 int j=i; //要插入的位置 for (;j>0 && a[j-1]>temp ;j-- ) {a[j]=a[j-1]; //将j-1的元素向后移动 } a[j]=temp; } //循环输出 for (int b:a ) { System.out.println(b); } } }
标签:++ ble class rgs ring 循环 code stat color
原文地址:http://www.cnblogs.com/zyy1130/p/6657464.html