code: public static int countExplicitHydrogens(IAtomContainer atomContainer, IAtom atom) {
          if (atomContainer == null || atom == null)
              throw new IllegalArgumentException("null container or atom provided");
          int hCount = 0;
          for (IAtom connected : atomContainer.getConnectedAtomsList(atom)) {
              if (Elements.HYDROGEN.getSymbol().equals(connected.getSymbol())) {
                  hCount++;
              }
          }
          return hCount;
      }
docs: Count explicit hydrogens.
  
  @param atomContainer the atom container to consider
  @return The number of explicit hydrogens on the given IAtom.
  @throws IllegalArgumentException if either the container or atom were null