code: public static void swapC(double[] array, int i, int j)
      {
          
          double tmp_i= array[i];
          double tmp_j = array[j];
          if(tmp_i > tmp_j)
          {
              array[i] = tmp_j;
              array[j] = tmp_i;
          }
      }
docs: Conditional swap, only swaps the values if array[i] &gt; array[j]
  @param array the array to potentially swap values in
  @param i the 1st index
  @param j the 2nd index