docs: private double getSurfaceSums4Sorting(int minEntries, int maxEntries, int[] entrySorting, int dim) {
      // avoid multiple MBR calculations by updating min/max-logs for the two
      // collections' bounds:
  
      // the first entries' maximum upper bounds
      double[] pqUBFirst = new double[dim];
      Arrays.fill(pqUBFirst, Double.NEGATIVE_INFINITY);
      // maintain the second entries' upper bounds
      List<Heap<DoubleIntPair>> pqUBSecond = new ArrayList<>(dim);
      for(int i = 0; i < dim; i++) {
        // Descending heap
        pqUBSecond.add(new TopBoundedHeap<DoubleIntPair>(maxEntries, Collections.reverseOrder()));
      }
      // the first entries' minimum lower bounds
      double[] pqLBFirst = new double[dim];
      Arrays.fill(pqLBFirst, Double.POSITIVE_INFINITY);
      // maintain the second entries' minimum lower bounds
      List<Heap<DoubleIntPair>> pqLBSecond = new ArrayList<>(dim);
      for(int i = 0; i < dim; i++) {
        // Ascending heap
        pqLBSecond.add(new TopBoundedHeap<DoubleIntPair>(maxEntries));
      }
      // initialize bounds for first entry collection
      for(int index = 0; index < minEntries; index++) {
        add2MBR(entrySorting, pqUBFirst, pqLBFirst, index);
      }
      HyperBoundingBox mbr1 = new HyperBoundingBox(pqLBFirst, pqUBFirst);
  
      // fill bounding queues for the second entry collection
      double[] minSecond = new double[dim];
      double[] maxSecond = new double[dim];
      Arrays.fill(maxSecond, Double.NEGATIVE_INFINITY);
      Arrays.fill(minSecond, Double.POSITIVE_INFINITY);
  
      assert entrySorting.length - maxEntries == minEntries;
      // initialize min/max entries of the second collections' tail
      for(int index = maxEntries; index < entrySorting.length; index++) {
        add2MBR(entrySorting, maxSecond, minSecond, index);
      }
      for(int i = 0; i < dim; i++) {
        // with index entrySorting.length => never to be removed
        pqLBSecond.get(i).add(new DoubleIntPair(minSecond[i], entrySorting.length));
        pqUBSecond.get(i).add(new DoubleIntPair(maxSecond[i], entrySorting.length));
      }
      // add the entries to be removed later on
      for(int index = minEntries; index < maxEntries; index++) {
        add2MBR(entrySorting, pqUBSecond, pqLBSecond, index);
      }
      for(int i = 0; i < minSecond.length; i++) {
        minSecond[i] = pqLBSecond.get(i).peek().first;
        maxSecond[i] = pqUBSecond.get(i).peek().first;
      }
      ModifiableHyperBoundingBox mbr2 = new ModifiableHyperBoundingBox(minSecond, maxSecond);
      double surfaceSum = SpatialUtil.perimeter(mbr1) + SpatialUtil.perimeter(mbr2);
  
      // generate the other distributions and file the surface sums
      for(int limit = minEntries; limit < maxEntries; limit++) {
        // extend first MBR by entry at position entrySorting[limit]:
        add2MBR(entrySorting, pqUBFirst, pqLBFirst, limit);
        // shrink entry at position entrySorting[limit] from second MBR:
        removeFromMBR(pqUBSecond, pqLBSecond, limit, mbr2);
        surfaceSum += SpatialUtil.perimeter(mbr1) + SpatialUtil.perimeter(mbr2);
      }
  
      return surfaceSum;
    }