code: public static int getElementCount(IMolecularFormula formula, IElement element) {
  
          int count = 0;
          for (IIsotope isotope : formula.isotopes()) {
              if (isotope.getSymbol().equals(element.getSymbol())) count += formula.getIsotopeCount(isotope);
          }
          return count;
      }
docs: Checks a set of Nodes for the occurrence of the isotopes in the
  molecular formula from a particular IElement. It returns 0 if the
  element does not exist. The search is based only on the IElement.
  
  @param   formula The MolecularFormula to check
  @param   element The IElement object
  @return          The occurrence of this element in this molecular formula