docs: public static final void sortKeyValuePairs(long[] keys, double[] values,
        int startInd, int endInd) {
      // Base case.
      if (endInd - startInd <= 1) {
        return;
      }
  
      // Choose pivot.
      int pivotInd = (int) (Math.random() * (endInd - startInd)) + startInd;
  
      // Perform swaps to partition array around the pivot.
      swap(keys, values, startInd, pivotInd);
      pivotInd = startInd;
  
      for (int i = startInd + 1; i < endInd; i++) {
        if (keys[i] < keys[pivotInd]) {
          swap(keys, values, pivotInd, pivotInd + 1);
          if (i != pivotInd + 1) {
            swap(keys, values, pivotInd, i);
          }
          pivotInd++;
        }
      }
  
      // Recursively sort the subcomponents of the arrays.
      sortKeyValuePairs(keys, values, startInd, pivotInd);
      sortKeyValuePairs(keys, values, pivotInd + 1, endInd);
    }