src/java.base/share/classes/java/text/NumberFormat.java
changeset 48026 89deac44e515
parent 47216 71c04702a3d5
child 48251 57148c79bd75
equal deleted inserted replaced
48025:6bc1de3b8c59 48026:89deac44e515
   238      * This may result in loss of magnitude information and precision for
   238      * This may result in loss of magnitude information and precision for
   239      * <code>BigInteger</code> and <code>BigDecimal</code> values.
   239      * <code>BigInteger</code> and <code>BigDecimal</code> values.
   240      * @param number     the number to format
   240      * @param number     the number to format
   241      * @param toAppendTo the <code>StringBuffer</code> to which the formatted
   241      * @param toAppendTo the <code>StringBuffer</code> to which the formatted
   242      *                   text is to be appended
   242      *                   text is to be appended
   243      * @param pos        On input: an alignment field, if desired.
   243      * @param pos        keeps track on the position of the field within the
   244      *                   On output: the offsets of the alignment field.
   244      *                   returned string. For example, for formatting a number
       
   245      *                   {@code 1234567.89} in {@code Locale.US} locale,
       
   246      *                   if the given {@code fieldPosition} is
       
   247      *                   {@link NumberFormat#INTEGER_FIELD}, the begin index
       
   248      *                   and end index of {@code fieldPosition} will be set
       
   249      *                   to 0 and 9, respectively for the output string
       
   250      *                   {@code 1,234,567.89}.
   245      * @return           the value passed in as <code>toAppendTo</code>
   251      * @return           the value passed in as <code>toAppendTo</code>
   246      * @exception        IllegalArgumentException if <code>number</code> is
   252      * @exception        IllegalArgumentException if <code>number</code> is
   247      *                   null or not an instance of <code>Number</code>.
   253      *                   null or not an instance of <code>Number</code>.
   248      * @exception        NullPointerException if <code>toAppendTo</code> or
   254      * @exception        NullPointerException if <code>toAppendTo</code> or
   249      *                   <code>pos</code> is null
   255      *                   <code>pos</code> is null
   340      * Specialization of format.
   346      * Specialization of format.
   341      *
   347      *
   342      * @param number     the double number to format
   348      * @param number     the double number to format
   343      * @param toAppendTo the StringBuffer to which the formatted text is to be
   349      * @param toAppendTo the StringBuffer to which the formatted text is to be
   344      *                   appended
   350      *                   appended
   345      * @param pos        the field position
   351      * @param pos        keeps track on the position of the field within the
       
   352      *                   returned string. For example, for formatting a number
       
   353      *                   {@code 1234567.89} in {@code Locale.US} locale,
       
   354      *                   if the given {@code fieldPosition} is
       
   355      *                   {@link NumberFormat#INTEGER_FIELD}, the begin index
       
   356      *                   and end index of {@code fieldPosition} will be set
       
   357      *                   to 0 and 9, respectively for the output string
       
   358      *                   {@code 1,234,567.89}.
   346      * @return the formatted StringBuffer
   359      * @return the formatted StringBuffer
   347      * @exception        ArithmeticException if rounding is needed with rounding
   360      * @exception        ArithmeticException if rounding is needed with rounding
   348      *                   mode being set to RoundingMode.UNNECESSARY
   361      *                   mode being set to RoundingMode.UNNECESSARY
   349      * @see java.text.Format#format
   362      * @see java.text.Format#format
   350      */
   363      */
   356      * Specialization of format.
   369      * Specialization of format.
   357      *
   370      *
   358      * @param number     the long number to format
   371      * @param number     the long number to format
   359      * @param toAppendTo the StringBuffer to which the formatted text is to be
   372      * @param toAppendTo the StringBuffer to which the formatted text is to be
   360      *                   appended
   373      *                   appended
   361      * @param pos        the field position
   374      * @param pos        keeps track on the position of the field within the
       
   375      *                   returned string. For example, for formatting a number
       
   376      *                   {@code 123456789} in {@code Locale.US} locale,
       
   377      *                   if the given {@code fieldPosition} is
       
   378      *                   {@link NumberFormat#INTEGER_FIELD}, the begin index
       
   379      *                   and end index of {@code fieldPosition} will be set
       
   380      *                   to 0 and 11, respectively for the output string
       
   381      *                   {@code 123,456,789}.
   362      * @return the formatted StringBuffer
   382      * @return the formatted StringBuffer
   363      * @exception        ArithmeticException if rounding is needed with rounding
   383      * @exception        ArithmeticException if rounding is needed with rounding
   364      *                   mode being set to RoundingMode.UNNECESSARY
   384      *                   mode being set to RoundingMode.UNNECESSARY
   365      * @see java.text.Format#format
   385      * @see java.text.Format#format
   366      */
   386      */