public void doInsertionSort(String[] names,int[] values){
  int i, j, t;
  String temp="";
  for (i=1; i < values.length; i++) {
    j=i;
    t=values[j];
    temp=names[j];
    while (j > 0 && values[j - 1] > t) {
      values[j]=values[j - 1];
      names[j]=names[j - 1];
      j--;
    }
    values[j]=t;
    names[j]=temp;
  }
}

public void doInsertionSort ( String [ ] names , int [ ] values ) { int i , j , t ; String temp = "" ; for ( i = 1 ; i < values . length ; i ++ ) { j = i ; t = values [ j ] ; temp = names [ j ] ; while ( j > 0 && values [ j - 1 ] > t ) { values [ j ] = values [ j - 1 ] ; names [ j ] = names [ j - 1 ] ; j -- ; } values [ j ] = t ; names [ j ] = temp ; } }
sorts the values ascendingly . the names array is sorted accordingly .
