code: static int[][] cyclesOfSizeFiveOrSix(IAtomContainer container, int[][] graph) {
          try {
              return Cycles.all(6).find(container, graph, 6).paths();
          } catch (Intractable intractable) {
              return new int[0][];
          }
      }
docs: Locate all 5 and 6 member cycles (rings) in a structure representation.
  
  @param container structure representation
  @param graph     adjacency list graph representation of structure
  @return closed walks (first = last vertex) of the cycles