code: public static /*@pure@*/ int[] sort(/*@non_null@*/ 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;
    }
docs: 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
  
  @param array this array is not changed by the method!
  @return an array of integers with the positions in the sorted
  array.