code: public IRingSet findAllRings(IAtomContainer container, int maxRingSize) throws CDKException {
  
          final EdgeToBondMap edges = EdgeToBondMap.withSpaceFor(container);
          final int[][] graph = GraphUtil.toAdjList(container, edges);
  
          RingSearch rs = new RingSearch(container, graph);
  
          IRingSet ringSet = container.getBuilder().newInstance(IRingSet.class);
  
          // don't need to run on isolated rings, just need to put vertices in
          // cyclic order
          for (int[] isolated : rs.isolated()) {
              if (isolated.length <= maxRingSize) {
                  IRing ring = toRing(container, edges, GraphUtil.cycle(graph, isolated));
                  ringSet.addAtomContainer(ring);
              }
          }
  
          // for each set of fused cyclic vertices run the separate search
          for (int[] fused : rs.fused()) {
  
              AllCycles ac = new AllCycles(GraphUtil.subgraph(graph, fused), Math.min(maxRingSize, fused.length),
                      threshold.value);
  
              if (!ac.completed()) throw new CDKException("Threshold exceeded for AllRingsFinder");
  
              for (int[] path : ac.paths()) {
                  IRing ring = toRing(container, edges, path, fused);
                  ringSet.addAtomContainer(ring);
              }
          }
  
          return ringSet;
      }
docs: Compute all rings up to and including the {@literal maxRingSize}. The
  container is first partitioned into ring systems which are then processed
  separately. If the molecule has already be partitioned, consider using
  {@link #findAllRingsInIsolatedRingSystem(IAtomContainer, int)}.
  
  @param container   The AtomContainer to be searched for rings
  @param maxRingSize Maximum ring size to consider. Provides a possible
  breakout from recursion for complex compounds.
  @return A RingSet with all rings in the AtomContainer
  @throws CDKException An exception thrown if the threshold was exceeded