code: private IMolecularFormula generateFormulaObject() {
          IMolecularFormula formulaObject = builder
                  .newInstance(IMolecularFormula.class);
          for (int i = 0; i < isotopes.length; i++) {
              if (currentCounts[i] == 0)
                  continue;
              formulaObject.addIsotope(isotopes[i], currentCounts[i]);
          }
          return formulaObject;
  
      }
docs: Generates a MolecularFormula object that contains the isotopes in the
  isotopes[] array with counts in the currentCounts[] array. In other
  words, generates a proper CDK representation of the currently examined
  formula.