code: private static IReactionSet extractPrecursorReaction(IReaction reaction, IReactionSet reactionSet) {
          IReactionSet reactConSet = reaction.getBuilder().newInstance(IReactionSet.class);
          for (IAtomContainer reactant : reaction.getReactants().atomContainers()) {
              for (IReaction reactionInt : reactionSet.reactions()) {
                  for (IAtomContainer precursor : reactionInt.getProducts().atomContainers()) {
                      if (reactant.equals(precursor)) {
                          reactConSet.addReaction(reactionInt);
                      }
                  }
              }
          }
          return reactConSet;
      }
docs: Extract reactions from a IReactionSet which at least one product is existing
  as reactant given a IReaction
  
  @param reaction    The IReaction to analyze
  @param reactionSet The IReactionSet to inspect
  @return            A IReactionSet containing the reactions