code: static int indexOfHetro(int[] cycle, int[] contribution) {
          int index = -1;
          for (int i = 0; i < cycle.length - 1; i++) {
              if (contribution[cycle[i]] == 2) index = index == -1 ? i : -2;
          }
          return index;
      }
docs: Find the index of a hetroatom in a cycle. A hetroatom in MMFF is the unique atom that
  contributes a pi-lone-pair to the aromatic system.
  
  @param cycle        aromatic cycle, |C| = 5
  @param contribution vector of p electron contributions from each vertex
  @return index of hetroatom, if none found index is < 0.