docs: private static int partition(Object[] a, int start, int end, Comparator<Object> cmp) {
          final int p = median(a, start, end, cmp);
          final Object pivot = a[p];
          a[p] = a[start];
          a[start] = pivot;
  
          int i = start;
          int j = end + 1;
  
          while (true) {
              while (cmp.compare(a[++i], pivot) < 0) {
                  if (i == end) {
                      break;
                  }
              }
              while (cmp.compare(a[--j], pivot) >= 0) {
                  if (j == start) {
                      break;
                  }
              }
              if (i >= j) {
                  break;
              }
              swap(a, i, j);
          }
  
          swap(a, start, j);
          return j;
      }