code: private IAtomContainer buildChain(int length, boolean isMainCyclic) {
          IAtomContainer currentChain;
          if (length > 0) {
              //If is cyclic
              if (isMainCyclic) {
                  //Rely on CDK's ring class constructor to generate our cyclic molecules.
                  currentChain = currentMolecule.getBuilder().newInstance(IAtomContainer.class);
                  currentChain.add(currentMolecule.getBuilder().newInstance(IRing.class, length, "C"));
              } //Else must not be cyclic
              else {
                  currentChain = makeAlkane(length);
              }
          } else {
              currentChain = currentMolecule.getBuilder().newInstance(IAtomContainer.class);
          }
  
          return currentChain;
      }
docs: Builds the main chain which may act as a foundation for futher working groups.
  
  @param mainChain The parsed prefix which depicts the chain's length.
  @param isMainCyclic A flag to show if the molecule is a ring. 0 means not a ring, 1 means is a ring.
  @return A Molecule containing the requested chain.