code: @SuppressWarnings("UnusedDeclaration")
      public static void checkPartition(int[] order, double[] values, double pivotValue, int start, int low, int high, int end) {
          if (order.length != values.length) {
              throw new IllegalArgumentException("Arguments must be same size");
          }
  
          if (!(start >= 0 && low >= start && high >= low && end >= high)) {
              throw new IllegalArgumentException(String.format("Invalid indices %d, %d, %d, %d", start, low, high, end));
          }
  
          for (int i = 0; i < low; i++) {
              double v = values[order[i]];
              if (v >= pivotValue) {
                  throw new IllegalArgumentException(String.format("Value greater than pivot at %d", i));
              }
          }
  
          for (int i = low; i < high; i++) {
              if (values[order[i]] != pivotValue) {
                  throw new IllegalArgumentException(String.format("Non-pivot at %d", i));
              }
          }
  
          for (int i = high; i < end; i++) {
              double v = values[order[i]];
              if (v <= pivotValue) {
                  throw new IllegalArgumentException(String.format("Value less than pivot at %d", i));
              }
          }
      }
docs: Check that a partition step was done correctly.  For debugging and testing.
  
  @param order      The array of indexes representing a permutation of the keys.
  @param values     The keys to sort.
  @param pivotValue The value that splits the data
  @param start      The beginning of the data of interest.
  @param low        Values from start (inclusive) to low (exclusive) are &lt; pivotValue.
  @param high       Values from low to high are equal to the pivot.
  @param end        Values from high to end are above the pivot.