private static void incrementalInsertionSort(Comparable[]a,int first,int last,int space){
int unsorted,index;
for(unsorted = first + space; unsorted <=last; unsorted = unsorted + space){
Comparable firstUnsorted = a[unsorted];
for(index = unsorted-space;(index >=first)&&(firstUnsorted.compareTo(a[index])<0);index = index -space)
{
a[index + space] = a[index];
}
a[index + space] = firstUnsorted;
}
}
//插入排序法核心代码。