static void insertionSort(int[] unsorted){
for (int i = 1; i < unsorted.length; i++) {
if (unsorted[i - 1] > unsorted[i]) {
int temp = unsorted[i];
int j;
for (j = i - 1; j >= 0 && unsorted[j] > temp; j--) {
unsorted[j + 1] = unsorted[j];
}
unsorted[j + 1] = temp;
}
}
}原文地址:http://11317783.blog.51cto.com/11307783/1977371