for (int j = 0; j < numEqual; j++) helpIndex[j] = i+j; quickSort(index, helpIndex, 0, numEqual-1); for (int j = 0; j < numEqual; j++) newIndex[i+j] = index[helpIndex[j]];
for (int j = 0; j < numEqual; j++) { helpIndex[j] = i + j; } quickSort(index, helpIndex, 0, numEqual - 1); for (int j = 0; j < numEqual; j++) { newIndex[i + j] = index[helpIndex[j]]; }
  public static int[] sort(double [] array){    int [] index = new int[array.length];    int [] newIndex = new int[array.length];    int [] helpIndex;    int numEqual;        for (int i = 0; i < index.length; i++)      index[i] = i;    quickSort(array,index,0,array.length-1);    // Make sort stable    int i = 0;    while (i < index.length) {      numEqual = 1;      for (int j = i+1; ((j < index.length) && Utils.eq(array[index[i]],							array[index[j]])); j++)	numEqual++;      if (numEqual > 1) {	helpIndex = new int[numEqual];	for (int j = 0; j < numEqual; j++)	  helpIndex[j] = i+j;	quickSort(index, helpIndex, 0, numEqual-1);	for (int j = 0; j < numEqual; j++) 	  newIndex[i+j] = index[helpIndex[j]];	i += numEqual;      } else {	newIndex[i] = index[i];	i++;      }    }    return newIndex;  }