code: @Override
      public StringBuffer format(BigDecimal number, StringBuffer result,
                                 FieldPosition fieldPosition) {
           // This method is just a copy of the corresponding java.math.BigDecimal method
           // for now. It isn't very efficient since it must create a conversion object to
           // do math on the rounding increment. In the future we may try to clean this up,
           // or even better, limit our support to just one flavor of BigDecimal.
          if (multiplier != 1) {
              number = number.multiply(BigDecimal.valueOf(multiplier), mathContext);
          }
  
          if (actualRoundingIncrementICU != null) {
              number = number.divide(actualRoundingIncrementICU, 0, roundingMode)
                  .multiply(actualRoundingIncrementICU, mathContext);
          }
  
          synchronized (digitList) {
              digitList.set(number, precision(false), !useExponentialNotation &&
                            !areSignificantDigitsUsed());
              // For issue 11808.
              if (digitList.wasRounded() && roundingMode == BigDecimal.ROUND_UNNECESSARY) {
                  throw new ArithmeticException("Rounding necessary");
              }
              return subformat(number.doubleValue(), result, fieldPosition, number.signum() < 0,
                               false, false);
          }
      }
docs: Formats a BigDecimal number.