code: public double getFinishedPercentage() {
          double result = 0.0;
          double remainingPerc = 1.0;
  
          // Keep a lock on currentCounts, otherwise it might change during the
          // calculation
          synchronized (currentCounts) {
              for (int i = currentCounts.length - 1; i >= 0; i--) {
                  double max = maxCounts[i];
                  if (i > 0)
                      max += 1.0;
                  result += remainingPerc * ((double) currentCounts[i] / max);
                  remainingPerc /= max;
              }
          }
          return result;
      }
docs: Returns a value between 0.0 and 1.0 indicating what portion of the search
  space has been examined so far by this MolecularFormulaGenerator. Before
  the first call to {@link FullEnumerationFormulaGenerator#getNextFormula()}, this method returns 0. After
  all possible formulas are generated, this method returns 1.0 (the exact
  returned value might be slightly off due to rounding errors). This method
  can be called from any thread.