code: private IRing prepareRing(List vec, IAtomContainer mol) {
          // add the atoms in vec to the new ring
          int atomCount = vec.size();
          IRing ring = mol.getBuilder().newInstance(IRing.class, atomCount);
          IAtom[] atoms = new IAtom[atomCount];
          vec.toArray(atoms);
          ring.setAtoms(atoms);
          // add the bonds in mol to the new ring
          try {
              IBond b;
              for (int i = 0; i < atomCount - 1; i++) {
                  b = mol.getBond(atoms[i], atoms[i + 1]);
                  if (b != null) {
                      ring.addBond(b);
                  } else {
                      logger.error("This should not happen.");
                  }
              }
              b = mol.getBond(atoms[0], atoms[atomCount - 1]);
              if (b != null) {
                  ring.addBond(b);
              } else {
                  logger.error("This should not happen either.");
              }
          } catch (Exception exc) {
              logger.debug(exc);
          }
          logger.debug("found Ring  ", ring);
          return ring;
      }
docs: Returns the ring that is formed by the atoms in the given vector.
  
  @param   vec  The vector that contains the atoms of the ring
  @param   mol  The molecule this ring is a substructure of
  @return     The ring formed by the given atoms