code: public static int getTotalFormalCharge(IAtomContainer atomContainer) {
          int chargeP = getTotalNegativeFormalCharge(atomContainer);
          int chargeN = getTotalPositiveFormalCharge(atomContainer);
  
          return chargeP + chargeN;
      }
docs: Get the total formal charge on a molecule.
  
  @param atomContainer the atom container to consider
  @return The summed formal charges of all atoms in this AtomContainer.