/**
插入法排序
* @param args
*/
public static void main(String[] args) {
int [] array={12,45,78,99,13,56};
System.out.print(Arrays.toString(insertSort(array)));
}
private static int[] insertSort(int[] array) {
for (int i = 1; i < array.length; i++) {
int temp = array[i];
for (int j = i - 1; j >= 0 && temp < array[j]; j--) {
array[j + 1] = array[j];
array[j] = temp;
}
}
return array;
}