code: double calculateHypervolumeIndicator(Solution<?> solutionA, Solution<?> solutionB, int d,
        double maximumValues[], double minimumValues[]) {
      double a, b, r, max;
      double volume ;
      double rho = 2.0;
  
      r = rho * (maximumValues[d - 1] - minimumValues[d - 1]);
      max = minimumValues[d - 1] + r;
  
      a = solutionA.getObjective(d - 1);
      if (solutionB == null) {
        b = max;
      } else {
        b = solutionB.getObjective(d - 1);
      }
  
      if (d == 1) {
        if (a < b) {
          volume = (b - a) / r;
        } else {
          volume = 0;
        }
      } else {
        if (a < b) {
          volume =
              calculateHypervolumeIndicator(solutionA, null, d - 1, maximumValues, minimumValues) * (b
                  - a) / r;
          volume +=
              calculateHypervolumeIndicator(solutionA, solutionB, d - 1, maximumValues, minimumValues)
                  * (max - b) / r;
        } else {
          volume =
              calculateHypervolumeIndicator(solutionA, solutionB, d - 1, maximumValues, minimumValues)
                  * (max - a) / r;
        }
      }
  
      return (volume);
    }
docs: Calculates the hypervolume of that portion of the objective space that
  is dominated by individual a but not by individual b