public static int[] sort(double[] array){
  int[] index=new int[array.length];
  array=(double[])array.clone();
  for (int i=0; i < index.length; i++) {
    index[i]=i;
    if (Double.isNaN(array[i])) {
      array[i]=Double.MAX_VALUE;
    }
  }
  quickSort(array,index,0,array.length - 1);
  return index;
}

public static int [ ] sort ( double [ ] array ) { int [ ] index = new int [ array . length ] ; array = ( double [ ] ) array . clone ( ) ; for ( int i = 0 ; i < index . length ; i ++ ) { index [ i ] = i ; if ( Double . isNaN ( array [ i ] ) ) { array [ i ] = Double . MAX_VALUE ; } } quickSort ( array , index , 0 , array . length - 1 ) ; return index ; }
sorts a given array of doubles in ascending order and returns an array of integers with the positions of the elements of the original array in the sorted array . note these changes : the sort is no longer stable and it doesn ' t use safe floating - point comparisons anymore . occurrences of double . nan are treated as double . max_value
