docs: private static int partition(final long[] arr, final int lo, final int hi) {
      int i = lo, j = hi + 1; //left and right scan indices
      final long v = arr[lo]; //partitioning item value
      while (true) {
        //Scan right, scan left, check for scan complete, and exchange
        while (arr[ ++i] < v) {
          if (i == hi) {
            break;
          }
        }
        while (v < arr[ --j]) {
          if (j == lo) {
            break;
          }
        }
        if (i >= j) {
          break;
        }
        final long x = arr[i];
        arr[i] = arr[j];
        arr[j] = x;
      }
      //put v=arr[j] into position with a[lo .. j-1] <= a[j] <= a[j+1 .. hi]
      final long x = arr[lo];
      arr[lo] = arr[j];
      arr[j] = x;
      return j;
    }