code: public int[] findHeavyAtomsInChain(IAtomContainer molecule, IAtomContainer chain) {
          int[] heavy = {-1, -1};
          int hc = 0;
          for (int i = 0; i < chain.getAtomCount(); i++) {
              if (isHeavyAtom(chain.getAtom(i))) {
                  if (heavy[0] < 0) {
                      heavy[0] = molecule.indexOf(chain.getAtom(i));
                  }
                  hc++;
              }
          }
          heavy[1] = hc;
          return heavy;
      }
docs: Count and find first heavy atom(s) (non Hydrogens) in a chain.
  
  @param  molecule the reference molecule for searching the chain
  @param  chain  chain to be searched
  @return        the atom number of the first heavy atom the number of heavy atoms in the chain