code: private int chooseRingNumber() {
          for (int i = 1; i < rnums.length; i++) {
              if (rnums[i] == 0) {
                  rnums[i] = 1;
                  return i;
              }
          }
          throw new IllegalStateException("No more ring numbers available!");
      }
docs: Select the lowest ring number for use in SMARTS.
  
  @return ring number
  @throws IllegalStateException all ring numbers are used