package com.hym.test;
public class PopSort {
int[] arrayTest = { 5, 26, 1, 783, 23, 2, 62, 9, 46 };
public void sort() {
for (int i = 0; i < arrayTest.length; i++) {
for (int j = 0; j < arrayTest.length - i; j++) {
if ((j + 1 < arrayTest.length)
&& arrayTest[j] > arrayTest[j + 1]) {
int temp = arrayTest[j];
arrayTest[j] = arrayTest[j + 1];
arrayTest[j + 1] = temp;
}
}
}
}
public static void main(String[] args) {
PopSort sort = new PopSort();
sort.sort();
for (int i = 0; i < sort.arrayTest.length; i++) {
System.out.print(sort.arrayTest[i] + " ");
}
}
}
[url]http://baike.baidu.com/view/254413.htm[/url]