diff --git a/src/share/classes/java/util/Formattable.java b/src/share/classes/java/util/Formattable.java index 28b788c340a84d45a6940f74e9287ded07add379..6f3fd1ab0802d16bae8f1c5246381f0ad871a4d0 100644 --- a/src/share/classes/java/util/Formattable.java +++ b/src/share/classes/java/util/Formattable.java @@ -36,7 +36,7 @@ import java.io.IOException; * For example, the following class prints out different representations of a * stock's name depending on the flags and length constraints: * - *
+ * {@code
* import java.nio.CharBuffer;
* import java.util.Formatter;
* import java.util.Formattable;
@@ -89,12 +89,12 @@ import java.io.IOException;
* return String.format("%s - %s", symbol, companyName);
* }
* }
- *
+ * }
*
* When used in conjunction with the {@link java.util.Formatter}, the above * class produces the following output for various format strings. * - *
+ * {@code
* Formatter fmt = new Formatter();
* StockName sn = new StockName("HUGE", "Huge Fruit, Inc.",
* "Fruit Titanesque, Inc.");
@@ -104,7 +104,7 @@ import java.io.IOException;
* fmt.format("%-10.8s", sn); // -> "HUGE "
* fmt.format("%.12s", sn); // -> "Huge Fruit,*"
* fmt.format(Locale.FRANCE, "%25s", sn); // -> " Fruit Titanesque, Inc."
- *
+ * }
*
* Formattables are not necessarily safe for multithreaded access. Thread * safety is optional and may be enforced by classes that extend and implement diff --git a/src/share/classes/java/util/Formatter.java b/src/share/classes/java/util/Formatter.java index 7906c763fe21c9756cb3660b625952b1f226e519..dae0b37f48b587bf54779ee645d1bdb7d0c6a4b4 100644 --- a/src/share/classes/java/util/Formatter.java +++ b/src/share/classes/java/util/Formatter.java @@ -841,7 +841,7 @@ import sun.misc.FormattedFloatingDecimal; * *
Numeric types will be formatted according to the following algorithm: * - *
Number Localization Algorithm + *
Number Localization Algorithm * *
After digits are obtained for the integer part, fractional part, and * exponent (as appropriate for the data type), the following transformation @@ -860,7 +860,7 @@ import sun.misc.FormattedFloatingDecimal; * substituted. * *
If the {@code '0'} flag is given and the value is negative, then * the zero padding will occur after the sign. @@ -1011,7 +1011,7 @@ import sun.misc.FormattedFloatingDecimal; *
If the {@code '#'} flag is given {@link * FormatFlagsConversionMismatchException} will be thrown. @@ -1155,7 +1155,7 @@ import sun.misc.FormattedFloatingDecimal; *
The formatting of the magnitude m depends upon its value. * @@ -1168,7 +1168,7 @@ import sun.misc.FormattedFloatingDecimal; * *
Otherwise, the result is a string that represents the sign and * magnitude (absolute value) of the argument. The formatting of the sign - * is described in the localization + * is described in the localization * algorithm. The formatting of the magnitude m depends upon its * value. * @@ -1207,7 +1207,7 @@ import sun.misc.FormattedFloatingDecimal; *
After rounding for the precision, the formatting of the resulting @@ -1236,12 +1236,12 @@ import sun.misc.FormattedFloatingDecimal; *
The result is a string that represents the sign and magnitude * (absolute value) of the argument. The formatting of the sign is - * described in the localization + * described in the localization * algorithm. The formatting of the magnitude m depends upon its * value. * @@ -1382,7 +1382,7 @@ import sun.misc.FormattedFloatingDecimal; *
The formatting of the magnitude m depends upon its value. * @@ -1391,7 +1391,7 @@ import sun.misc.FormattedFloatingDecimal; * *
Otherwise, the result is a string that represents the sign and * magnitude (absolute value) of the argument. The formatting of the sign - * is described in the localization + * is described in the localization * algorithm. The formatting of the magnitude m depends upon its * value. * @@ -1428,7 +1428,7 @@ import sun.misc.FormattedFloatingDecimal; *
After rounding for the precision, the formatting of the resulting @@ -1457,12 +1457,12 @@ import sun.misc.FormattedFloatingDecimal; *
The result is a string that represents the sign and magnitude * (absolute value) of the argument. The formatting of the sign is - * described in the localization + * described in the localization * algorithm. The formatting of the magnitude m depends upon its * value. * @@ -1721,7 +1721,7 @@ import sun.misc.FormattedFloatingDecimal; * conversions applies. If the {@code '#'} flag is given, then a {@link * FormatFlagsConversionMismatchException} will be thrown. * - *
The width is the minimum number of characters to + *
The width is the minimum number of characters to * be written to the output. If the length of the converted value is less than * the {@code width} then the output will be padded by spaces * ('\u0020') until the total number of characters equals width. @@ -1741,7 +1741,7 @@ import sun.misc.FormattedFloatingDecimal; *
The width is the minimum number of characters to + *
The width is the minimum number of characters to * be written to the output including the {@code '%'}. If the length of the * converted value is less than the {@code width} then the output will be * padded by spaces ('\u0020') until the total number of @@ -2590,7 +2590,20 @@ public final class Formatter implements Closeable, Flushable { public String toString() { return s; } } - public enum BigDecimalLayoutForm { SCIENTIFIC, DECIMAL_FLOAT }; + /** + * Enum for {@code BigDecimal} formatting. + */ + public enum BigDecimalLayoutForm { + /** + * Format the {@code BigDecimal} in computerized scientific notation. + */ + SCIENTIFIC, + + /** + * Format the {@code BigDecimal} as a decimal number. + */ + DECIMAL_FLOAT + }; private class FormatSpecifier implements FormatString { private int index = -1;