标签:stat system oid i++ print sort void col for
1 public class BubbleSort{ 2 public static void main(String args[]){ 3 BubbleSort bubbleSort=new BubbleSort(); 4 5 int arr_test[]={5,6,2,1,9}; 6 bubbleSort.bubbleSort(arr_test); 7 for(int num:arr_test){ 8 System.out.print(num+" "); 9 } 10 } 11 12 public void bubbleSort(int arr[]){ 13 int tmp; 14 for(int i=0;i<arr.length;i++){ 15 for(int j=0;j<arr.length-1-i;j++){ 16 if(arr[j]>arr[j+1]){ 17 tmp=arr[j]; 18 arr[j]=arr[j+1]; 19 arr[j+1]=tmp; 20 } 21 } 22 } 23 24 } 25 }
标签:stat system oid i++ print sort void col for
原文地址:https://www.cnblogs.com/zhaozishuang/p/11187964.html