code: @Override
      public StringBuffer format(Object number,
                                 StringBuffer toAppendTo,
                                 FieldPosition pos) {
          if (number instanceof Long) {
              return format(((Long)number).longValue(), toAppendTo, pos);
          } else if (number instanceof BigInteger) {
              return format((BigInteger) number, toAppendTo, pos);
          } else if (number instanceof java.math.BigDecimal) {
              return format((java.math.BigDecimal) number, toAppendTo, pos);
          } else if (number instanceof android.icu.math.BigDecimal) {
              return format((android.icu.math.BigDecimal) number, toAppendTo, pos);
          } else if (number instanceof CurrencyAmount) {
              return format((CurrencyAmount)number, toAppendTo, pos);
          } else if (number instanceof Number) {
              return format(((Number)number).doubleValue(), toAppendTo, pos);
          } else {
              throw new IllegalArgumentException("Cannot format given Object as a Number");
          }
      }
docs: Formats a number and appends the resulting text to the given string buffer.
  <strong>[icu] Note:</strong> recognizes <code>BigInteger</code>
  and <code>BigDecimal</code> objects.
  @see java.text.Format#format(Object, StringBuffer, FieldPosition)