public class Bubble {

	
	public static final int a[] = {3,2,5,6,8,10,4,7,9,1};
	public static final int length = a.length;
	
	public static void main(String[] args) {
		
		for(int i = 1 ;  i < length ; i++){
			
			for(int j = 0; j < length-i ; j++){
				int temp;
				if(a[j+1]>a[j]){
					temp = a[j];
					a[j] = a[j+1];
					a[j+1] = temp;
				}
			}
		}
		
		for(int i = 0 ; i <length ; i++){
			System.out.print(a[i]+"  ");
		}

	}

}

  

相关文章:

  • 2017-12-08
  • 2022-12-23
  • 2021-10-04
  • 2021-07-01
  • 2022-02-13
  • 2021-08-01
  • 2021-11-14
  • 2021-12-05
猜你喜欢
  • 2018-10-13
  • 2021-06-29
  • 2021-11-28
  • 2022-12-23
  • 2021-10-01
  • 2021-06-16
  • 2021-04-07
相关资源
相似解决方案