code: public void doSubstitution(long number, StringBuilder toInsertInto, int position, int recursionCount) {
          // perform a transformation on the number that is dependent
          // on the type of substitution this is, then just call its
          // rule set's format() method to format the result
          long numberToFormat = transformNumber(number);
  
          if (ruleSet != null) {
              ruleSet.format(numberToFormat, toInsertInto, position + pos, recursionCount);
          } else {
              toInsertInto.insert(position + pos, numberFormat.format(numberToFormat));
          }
      }
docs: Performs a mathematical operation on the number, formats it using
  either ruleSet or decimalFormat, and inserts the result into
  toInsertInto.
  @param number The number being formatted.
  @param toInsertInto The string we insert the result into
  @param position The position in toInsertInto where the owning rule's
  rule text begins (this value is added to this substitution's
  position to determine exactly where to insert the new text)