标签:冒泡排序 util i++ sea ack arc pac rgs java
1 package com.datastack.search; 2 3 import java.util.Arrays; 4 5 //冒泡排序 6 public class BubSearch { 7 public static void main(String[] args) { 8 int[] arr = {6,1,8,23,3,5,6,9,12}; 9 int temp; 10 for(int i=0; i<arr.length; i++){ 11 for(int j=0; j<arr.length-1-i; j++){ 12 if(arr[j]>arr[j+1]){ 13 temp = arr[j]; 14 arr[j] = arr[j+1]; 15 arr[j+1] = temp; 16 } 17 } 18 } 19 System.out.println(Arrays.toString(arr)); 20 } 21 }
标签:冒泡排序 util i++ sea ack arc pac rgs java
原文地址:https://www.cnblogs.com/linux777/p/11565994.html