diff --git a/src/java.base/share/classes/java/text/DecimalFormat.java b/src/java.base/share/classes/java/text/DecimalFormat.java index ba7846ea404..2260684d6ee 100644 --- a/src/java.base/share/classes/java/text/DecimalFormat.java +++ b/src/java.base/share/classes/java/text/DecimalFormat.java @@ -84,9 +84,18 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * the {@code NumberFormat} factory methods, the pattern and symbols are * read from localized {@code ResourceBundle}s. * - *

Patterns

+ *

Patterns

* - * {@code DecimalFormat} patterns have the following syntax: + * Note: For any given {@code DecimalFormat} pattern, if the pattern is not + * in scientific notation, the maximum number of integer digits will not be + * derived from the pattern, and instead set to {@link Integer#MAX_VALUE}. + * Otherwise, if the pattern is in scientific notation, the maximum number of + * integer digits will be derived from the pattern. This derivation is detailed + * in the {@link ##scientific_notation Scientific Notation} section. This behavior + * is the typical end-user desire; {@link #setMaximumIntegerDigits(int)} can be + * used to manually adjust the maximum integer digits. + * + *

{@code DecimalFormat} patterns have the following syntax: *

  * Pattern:
  *         PositivePattern
@@ -245,7 +254,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
  * 
  * 
* - *

Scientific Notation

+ *

Scientific Notation

* *

Numbers in scientific notation are expressed as the product of a mantissa * and a power of ten, for example, 1234 can be expressed as 1.234 x 10^3. The @@ -449,6 +458,8 @@ public class DecimalFormat extends NumberFormat { * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale. * This is a convenient way to obtain a * DecimalFormat when internationalization is not the main concern. + * The number of maximum integer digits is usually not derived from the pattern. + * See the note in the {@link ##patterns Patterns} section for more detail. *

* To obtain standard formats for a given locale, use the factory methods * on NumberFormat such as getNumberInstance. These factories will @@ -474,6 +485,8 @@ public class DecimalFormat extends NumberFormat { * Creates a DecimalFormat using the given pattern and symbols. * Use this constructor when you need to completely customize the * behavior of the format. + * The number of maximum integer digits is usually not derived from the pattern. + * See the note in the {@link ##patterns Patterns} section for more detail. *

* To obtain standard formats for a given * locale, use the factory methods on NumberFormat such as @@ -3298,9 +3311,8 @@ public class DecimalFormat extends NumberFormat { * These properties can also be changed individually through the * various setter methods. *

- * There is no limit to integer digits set - * by this routine, since that is the typical end-user desire; - * use setMaximumInteger if you want to set a real value. + * The number of maximum integer digits is usually not derived from the pattern. + * See the note in the {@link ##patterns Patterns} section for more detail. * For negative numbers, use a second pattern, separated by a semicolon *

Example {@code "#,#00.0#"} → 1,234.56 *

This means a minimum of 2 integer digits, 1 fraction digit, and @@ -3325,9 +3337,8 @@ public class DecimalFormat extends NumberFormat { * These properties can also be changed individually through the * various setter methods. *

- * There is no limit to integer digits set - * by this routine, since that is the typical end-user desire; - * use setMaximumInteger if you want to set a real value. + * The number of maximum integer digits is usually not derived from the pattern. + * See the note in the {@link ##patterns Patterns} section for more detail. * For negative numbers, use a second pattern, separated by a semicolon *

Example {@code "#,#00.0#"} → 1,234.56 *

This means a minimum of 2 integer digits, 1 fraction digit, and