for(int i=1;i<a.length;i++){
int insertValue=a[i];
int index=i-1;
while(index>=0&&insertValue<a[index]){
a[index+1]=a[index];
index--;
}
a[index+1]=insertValue;
}
for(int i=1;i<a.length;i++){
int insertValue=a[i];
int index=i-1;
while(index>=0&&insertValue<a[index]){
a[index+1]=a[index];
index--;
}
a[index+1]=insertValue;
}