code: public IAtomContainer ringFragments() {
  
          int[] vertices = cyclic();
  
          int n = vertices.length;
  
          IAtom[] atoms = new IAtom[n];
          List<IBond> bonds = new ArrayList<IBond>();
  
          for (int i = 0; i < vertices.length; i++) {
              atoms[i] = container.getAtom(vertices[i]);
          }
  
          for (IBond bond : container.bonds()) {
  
              IAtom either = bond.getBegin();
              IAtom other = bond.getEnd();
  
              int u = container.indexOf(either);
              int v = container.indexOf(other);
  
              // add the bond if the vertex colors match
              if (searcher.cyclic(u, v)) bonds.add(bond);
          }
  
          IChemObjectBuilder builder = container.getBuilder();
          IAtomContainer fragment = builder.newInstance(IAtomContainer.class, 0, 0, 0, 0);
  
          fragment.setAtoms(atoms);
          fragment.setBonds(bonds.toArray(new IBond[bonds.size()]));
  
          return fragment;
  
      }
docs: Extract the cyclic atom and bond fragments of the container. Bonds which
  join two different isolated/fused cycles (e.g. biphenyl) are not be
  included.
  
  @return a new container with only the cyclic atoms and bonds
  @see org.openscience.cdk.graph.SpanningTree#getCyclicFragmentsContainer()