code: public static IReactionScheme createReactionScheme(IReactionSet reactionSet) {
          IReactionScheme reactionScheme = reactionSet.getBuilder().newInstance(IReactionScheme.class);
  
          // Looking for those reactants which doesn't have any precursor. They are the top.
          ArrayList<IReaction> listTopR = new ArrayList<IReaction>();
          for (IReaction reaction : reactionSet.reactions()) {
              if (extractPrecursorReaction(reaction, reactionSet).getReactionCount() == 0) listTopR.add(reaction);
          }
  
          for (IReaction reaction : listTopR) {
              reactionScheme.addReaction(reaction);
              IReactionScheme newReactionScheme = setScheme(reaction, reactionSet);
              if (newReactionScheme.getReactionCount() != 0 || newReactionScheme.getReactionSchemeCount() != 0)
                  reactionScheme.add(newReactionScheme);
          }
          return reactionScheme;
      }
docs: Create a IReactionScheme give a IReactionSet object.
  
  @param  reactionSet The IReactionSet
  @return             The IReactionScheme