code: private IRing toRing(IAtomContainer container, EdgeToBondMap edges, int[] cycle) {
          IRing ring = container.getBuilder().newInstance(IRing.class, 0);
  
          int len = cycle.length - 1;
  
          IAtom[] atoms = new IAtom[len];
          IBond[] bonds = new IBond[len];
  
          for (int i = 0; i < len; i++) {
              atoms[i] = container.getAtom(cycle[i]);
              bonds[i] = edges.get(cycle[i], cycle[i + 1]);
              atoms[i].setFlag(CDKConstants.ISINRING, true);
          }
  
          ring.setAtoms(atoms);
          ring.setBonds(bonds);
  
          return ring;
      }
docs: Convert a cycle in {@literal int[]} representation to an {@link IRing}.
  
  @param container atom container
  @param edges     edge map
  @param cycle     vertex walk forming the cycle, first and last vertex the
  same
  @return a new ring