code: public static IMolecularFormula getMaxOccurrenceElements(IMolecularFormulaSet mfSet) {
  
          IMolecularFormula molecularFormula = mfSet.getBuilder().newInstance(IMolecularFormula.class);
          for (IMolecularFormula mf : mfSet.molecularFormulas()) {
              for (IIsotope isotope : mf.isotopes()) {
                  IElement element = mfSet.getBuilder().newInstance(IElement.class, isotope);
                  int occur_new = MolecularFormulaManipulator.getElementCount(mf, element);
                  if (!MolecularFormulaManipulator.containsElement(molecularFormula, element)) {
                      molecularFormula.addIsotope(mfSet.getBuilder().newInstance(IIsotope.class, element), occur_new);
                  } else {
                      int occur_old = MolecularFormulaManipulator.getElementCount(molecularFormula, element);
                      if (occur_new > occur_old) {
                          MolecularFormulaManipulator.removeElement(molecularFormula, element);
                          molecularFormula.addIsotope(mfSet.getBuilder().newInstance(IIsotope.class, element), occur_new);
                      }
                  }
              }
          }
          return molecularFormula;
      }
docs: Extract from a set of MolecularFormula the maximum occurrence of each element found and
  put the element and occurrence in a new IMolecularFormula.
  
  @param mfSet    The set of molecularFormules to inspect
  @return         A IMolecularFormula containing the maximum occurrence of the elements
  @see            #getMinOccurrenceElements(IMolecularFormulaSet)