class MmffAromaticTypeMapping {

    static boolean isAromaticRing(int[] cycle, int[] contribution, int[] dbs, boolean[] aromatic) {

        int len = cycle.length - 1;
        int sum = 0;

        int i = 0;
        int iPrev = len - 1;
        int iNext = 1;

        while (i < len) {

            int prev = cycle[iPrev];
            int curr = cycle[i];
            int next = cycle[iNext];

            int pElectrons = contribution[curr];

            if (pElectrons < 0) return false;

            // single p electrons are only donated from double bonds, these are
            // only counted if the bonds are either in this ring or the bond
            // is aromatic
            if (pElectrons == 1) {
                final int other = dbs[curr];
                if (other < 0) return false;
                if (other != prev && other != next && !aromatic[other]) return false;
            }

            iPrev = i;
            i = iNext;
            iNext = iNext + 1;
            sum += pElectrons;
        }

        // the sum of electrons 4n+2?
        return (sum - 2) % 4 == 0;
    }

      MmffAromaticTypeMapping();

}