code: private static IRing toRing(IAtomContainer container, int[] cycle, EdgeToBondMap bondMap) {
  
          IAtom[] atoms = new IAtom[cycle.length - 1];
          IBond[] bonds = new IBond[cycle.length - 1];
  
          for (int i = 1; i < cycle.length; i++) {
              int v = cycle[i];
              int u = cycle[i - 1];
              atoms[i - 1] = container.getAtom(u);
              bonds[i - 1] = getBond(container, bondMap, u, v);
          }
  
          IChemObjectBuilder builder = container.getBuilder();
          IAtomContainer ring = builder.newInstance(IAtomContainer.class, 0, 0, 0, 0);
          ring.setAtoms(atoms);
          ring.setBonds(bonds);
  
          return builder.newInstance(IRing.class, ring);
      }
docs: Internal - convert a set of cycles to a ring.
  
  @param container molecule
  @param cycle     a cycle of the chemical graph
  @param bondMap   mapping of the edges (int,int) to the bonds of the
  container
  @return the ring for the specified cycle