code: private List<List<Integer>> assignRingGroups(List<Integer[]> rBondsArray) {
          List<List<Integer>> ringGroups;
          ringGroups = new ArrayList<List<Integer>>();
          for (int i = 0; i < rBondsArray.size() - 1; i++) { //for each ring except the last in rBondsArray
              for (int j = 0; j < rBondsArray.get(i).length; j++) { //for each bond in each ring
  
                  //check there's no shared bond with any other ring already in ringGroups
                  for (int k = i + 1; k < rBondsArray.size(); k++) {
                      for (int l = 0; l < rBondsArray.get(k).length; l++) { //for each ring in each ring
  
                          //Is there a bond in common? Then add both rings
                          if (Objects.equals(rBondsArray.get(i)[j], rBondsArray.get(k)[l])) {
                              if (i != k) {
                                  ringGroups.add(new ArrayList<Integer>());
                                  ringGroups.get(ringGroups.size() - 1).add(i);
                                  ringGroups.get(ringGroups.size() - 1).add(k);
                              }
                          }
                      }
                  }
              }
          }
          while (combineGroups(ringGroups));
  
          //Anything not added yet is a singleton
          for (int i = 0; i < rBondsArray.size(); i++) {
              boolean found = false;
              for (int j = 0; j < ringGroups.size(); j++) {
                  if (ringGroups.get(j).contains(i)) {
                      found = true;
                      break;
                  }
              }
              if (!found) {
                  ringGroups.add(new ArrayList<Integer>());
                  ringGroups.get(ringGroups.size() - 1).add(i);
              }
          }
          return ringGroups;
      }
docs: Assigns a set of rings to groups each sharing a bond.
  
  @param rBondsArray
  @return A List of Lists each containing the ring indices of a set of fused rings