code: @Override
      public AttributedCharacterIterator formatToCharacterIterator(Object obj) {
          CharacterIteratorFieldDelegate delegate =
                           new CharacterIteratorFieldDelegate();
          StringBuffer sb = new StringBuffer();
  
          if (obj instanceof Double || obj instanceof Float) {
              format(((Number)obj).doubleValue(), sb, delegate);
          } else if (obj instanceof Long || obj instanceof Integer ||
                     obj instanceof Short || obj instanceof Byte ||
                     obj instanceof AtomicInteger || obj instanceof AtomicLong) {
              format(((Number)obj).longValue(), sb, delegate);
          } else if (obj instanceof BigDecimal) {
              format((BigDecimal)obj, sb, delegate);
          } else if (obj instanceof BigInteger) {
              format((BigInteger)obj, sb, delegate, false);
          } else if (obj == null) {
              throw new NullPointerException(
                  "formatToCharacterIterator must be passed non-null object");
          } else {
              throw new IllegalArgumentException(
                  "Cannot format given Object as a Number");
          }
          return delegate.getIterator(sb.toString());
      }
docs: Formats an Object producing an <code>AttributedCharacterIterator</code>.
  You can use the returned <code>AttributedCharacterIterator</code>
  to build the resulting String, as well as to determine information
  about the resulting String.
  <p>
  Each attribute key of the AttributedCharacterIterator will be of type
  <code>NumberFormat.Field</code>, with the attribute value being the
  same as the attribute key.
  
  @exception NullPointerException if obj is null.
  @exception IllegalArgumentException when the Format cannot format the
  given object.
  @exception        ArithmeticException if rounding is needed with rounding
  mode being set to RoundingMode.UNNECESSARY
  @param obj The object to format
  @return AttributedCharacterIterator describing the formatted value.
  @since 1.4