Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited Constants](https://developer.android.com/reference/android/icu/text/CompactDecimalFormat#inhconstants) \| [Methods](https://developer.android.com/reference/android/icu/text/CompactDecimalFormat#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/icu/text/CompactDecimalFormat#inhmethods)

# CompactDecimalFormat

*** ** * ** ***


`
public


class
CompactDecimalFormat
`


`


`

`


`

`


`

`


`

`

extends https://developer.android.com/reference/android/icu/text/DecimalFormat


`

`


`

|---|---|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||||||
| ↳ | [java.text.Format](https://developer.android.com/reference/java/text/Format) |||||
|   | ↳ | [android.icu.text.UFormat](https://developer.android.com/reference/android/icu/text/UFormat) ||||
|   |   | ↳ | [android.icu.text.NumberFormat](https://developer.android.com/reference/android/icu/text/NumberFormat) |||
|   |   |   | ↳ | [android.icu.text.DecimalFormat](https://developer.android.com/reference/android/icu/text/DecimalFormat) ||
|   |   |   |   | ↳ | android.icu.text.CompactDecimalFormat |

<br />

*** ** * ** ***

Formats numbers in compact (abbreviated) notation, like "1.2K" instead of "1200".


**IMPORTANT:** New users are strongly encouraged to see if
`https://developer.android.com/reference/android/icu/number/NumberFormatter` fits their use case. Although not deprecated, this
class, CompactDecimalFormat, is provided for backwards compatibility only.

*** ** * ** ***

The CompactDecimalFormat produces abbreviated numbers, suitable for display in environments will limited real estate. For example, 'Hits: 1.2B' instead of 'Hits: 1,200,000,000'. The format will be appropriate for the given language, such as "1,2 Mrd." for German.

For numbers under 1000 trillion (under 10\^15, such as 123,456,789,012,345), the result will be
short for supported languages. However, the result may sometimes exceed 7 characters, such as
when there are combining marks or thin characters. In such cases, the visual width in fonts
should still be short.

By default, there are 2 significant digits. After creation, if more than three significant
digits are set (with setMaximumSignificantDigits), or if a fixed number of digits are set (with
setMaximumIntegerDigits or setMaximumFractionDigits), then result may be wider.

The "short" style is also capable of formatting currency amounts, such as "$1.2M" instead of
"$1,200,000.00" (English) or "5,3 Mio. \\u20ac" instead of "5.300.000,00 \\u20ac" (German). Localized data
concerning longer formats is not available yet in the Unicode CLDR. Because of this, attempting
to format a currency amount using the "long" style will produce an UnsupportedOperationException.

At this time, negative numbers and parsing are not supported, and will produce an
UnsupportedOperationException. Resetting the pattern prefixes or suffixes is not supported; the
method calls are ignored.

Note that important methods, like setting the number of decimals, will be moved up from
DecimalFormat to NumberFormat.

## Summary

| ### Inherited constants |
|---|
| From class `https://developer.android.com/reference/android/icu/text/DecimalFormat` |---|---| | `int` | `https://developer.android.com/reference/android/icu/text/DecimalFormat#MINIMUM_GROUPING_DIGITS_AUTO` **\[icu\]** Constant for `https://developer.android.com/reference/android/icu/text/DecimalFormat#setMinimumGroupingDigits(int)` to specify display grouping using the default strategy for all locales. | | `int` | `https://developer.android.com/reference/android/icu/text/DecimalFormat#MINIMUM_GROUPING_DIGITS_MIN2` **\[icu\]** Constant for `https://developer.android.com/reference/android/icu/text/DecimalFormat#setMinimumGroupingDigits(int)` to specify display grouping using locale defaults, except do not show grouping on values smaller than 10000 (such that there is a minimum of two digits before the first separator). | | `int` | `https://developer.android.com/reference/android/icu/text/DecimalFormat#PAD_AFTER_PREFIX` **\[icu\]** Constant for `https://developer.android.com/reference/android/icu/text/DecimalFormat#getPadPosition()` and `https://developer.android.com/reference/android/icu/text/DecimalFormat#setPadPosition(int)` to specify pad characters inserted after the prefix. | | `int` | `https://developer.android.com/reference/android/icu/text/DecimalFormat#PAD_AFTER_SUFFIX` **\[icu\]** Constant for `https://developer.android.com/reference/android/icu/text/DecimalFormat#getPadPosition()` and `https://developer.android.com/reference/android/icu/text/DecimalFormat#setPadPosition(int)` to specify pad characters inserted after the suffix. | | `int` | `https://developer.android.com/reference/android/icu/text/DecimalFormat#PAD_BEFORE_PREFIX` **\[icu\]** Constant for `https://developer.android.com/reference/android/icu/text/DecimalFormat#getPadPosition()` and `https://developer.android.com/reference/android/icu/text/DecimalFormat#setPadPosition(int)` to specify pad characters inserted before the prefix. | | `int` | `https://developer.android.com/reference/android/icu/text/DecimalFormat#PAD_BEFORE_SUFFIX` **\[icu\]** Constant for `https://developer.android.com/reference/android/icu/text/DecimalFormat#getPadPosition()` and `https://developer.android.com/reference/android/icu/text/DecimalFormat#setPadPosition(int)` to specify pad characters inserted before the suffix. | |
| From class `https://developer.android.com/reference/android/icu/text/NumberFormat` |---|---| | `int` | `https://developer.android.com/reference/android/icu/text/NumberFormat#ACCOUNTINGCURRENCYSTYLE` **\[icu\]** Constant to specify currency style of format which uses currency symbol to represent currency for accounting, for example: "($3.00), instead of "-$3.00" (`https://developer.android.com/reference/android/icu/text/NumberFormat#CURRENCYSTYLE`). | | `int` | `https://developer.android.com/reference/android/icu/text/NumberFormat#CASHCURRENCYSTYLE` **\[icu\]** Constant to specify currency cash style of format which uses currency ISO code to represent currency, for example: "NT$3" instead of "NT$3.23". | | `int` | `https://developer.android.com/reference/android/icu/text/NumberFormat#CURRENCYSTYLE` **\[icu\]** Constant to specify general currency style of format. | | `int` | `https://developer.android.com/reference/android/icu/text/NumberFormat#FRACTION_FIELD` Field constant used to construct a FieldPosition object. | | `int` | `https://developer.android.com/reference/android/icu/text/NumberFormat#INTEGERSTYLE` **\[icu\]** Constant to specify a integer number style format. | | `int` | `https://developer.android.com/reference/android/icu/text/NumberFormat#INTEGER_FIELD` Field constant used to construct a FieldPosition object. | | `int` | `https://developer.android.com/reference/android/icu/text/NumberFormat#ISOCURRENCYSTYLE` **\[icu\]** Constant to specify currency style of format which uses currency ISO code to represent currency, for example: "USD3.00". | | `int` | `https://developer.android.com/reference/android/icu/text/NumberFormat#NUMBERSTYLE` **\[icu\]** Constant to specify normal number style of format. | | `int` | `https://developer.android.com/reference/android/icu/text/NumberFormat#PERCENTSTYLE` **\[icu\]** Constant to specify a style of format to display percent. | | `int` | `https://developer.android.com/reference/android/icu/text/NumberFormat#PLURALCURRENCYSTYLE` **\[icu\]** Constant to specify currency style of format which uses currency long name with plural format to represent currency, for example, "3.00 US Dollars". | | `int` | `https://developer.android.com/reference/android/icu/text/NumberFormat#SCIENTIFICSTYLE` **\[icu\]** Constant to specify a style of format to display scientific number. | | `int` | `https://developer.android.com/reference/android/icu/text/NumberFormat#STANDARDCURRENCYSTYLE` **\[icu\]** Constant to specify currency style of format which uses currency symbol to represent currency, for example "$3.00", using non-accounting style for negative values (e.g. | |

| ### Public methods ||
|---|---|
| ` static https://developer.android.com/reference/android/icu/text/CompactDecimalFormat` | ` https://developer.android.com/reference/android/icu/text/CompactDecimalFormat#getInstance(android.icu.util.ULocale,%20android.icu.text.CompactDecimalFormat.CompactStyle)(https://developer.android.com/reference/android/icu/util/ULocale locale, https://developer.android.com/reference/android/icu/text/CompactDecimalFormat.CompactStyle style) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. |
| ` static https://developer.android.com/reference/android/icu/text/CompactDecimalFormat` | ` https://developer.android.com/reference/android/icu/text/CompactDecimalFormat#getInstance(java.util.Locale,%20android.icu.text.CompactDecimalFormat.CompactStyle)(https://developer.android.com/reference/java/util/Locale locale, https://developer.android.com/reference/android/icu/text/CompactDecimalFormat.CompactStyle style) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. |
| ` https://developer.android.com/reference/java/lang/Number` | ` https://developer.android.com/reference/android/icu/text/CompactDecimalFormat#parse(java.lang.String,%20java.text.ParsePosition)(https://developer.android.com/reference/java/lang/String text, https://developer.android.com/reference/java/text/ParsePosition parsePosition) ` Parsing is currently unsupported, and throws an UnsupportedOperationException. |
| ` https://developer.android.com/reference/android/icu/util/CurrencyAmount` | ` https://developer.android.com/reference/android/icu/text/CompactDecimalFormat#parseCurrency(java.lang.CharSequence,%20java.text.ParsePosition)(https://developer.android.com/reference/java/lang/CharSequence text, https://developer.android.com/reference/java/text/ParsePosition parsePosition) ` Parsing is currently unsupported, and throws an UnsupportedOperationException. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/android/icu/text/DecimalFormat ` |---|---| | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#applyLocalizedPattern(java.lang.String)(https://developer.android.com/reference/java/lang/String localizedPattern) ` Converts the given string to standard notation and then parses it using `https://developer.android.com/reference/android/icu/text/DecimalFormat#applyPattern(java.lang.String)`. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#applyPattern(java.lang.String)(https://developer.android.com/reference/java/lang/String pattern) ` Parses the given pattern string and overwrites the settings specified in the pattern string. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#areSignificantDigitsUsed()() ` **\[icu\]** Returns whether significant digits are being used in rounding. | | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#clone()() ` Overrides clone. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Tests for equality between this formatter and another formatter. | | ` https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#format(java.math.BigInteger,%20java.lang.StringBuffer,%20java.text.FieldPosition)(https://developer.android.com/reference/java/math/BigInteger number, https://developer.android.com/reference/java/lang/StringBuffer result, https://developer.android.com/reference/java/text/FieldPosition fieldPosition) ` **\[icu\]** Formats a BigInteger. | | ` https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#format(android.icu.util.CurrencyAmount,%20java.lang.StringBuffer,%20java.text.FieldPosition)(https://developer.android.com/reference/android/icu/util/CurrencyAmount currAmt, https://developer.android.com/reference/java/lang/StringBuffer result, https://developer.android.com/reference/java/text/FieldPosition fieldPosition) ` **\[icu\]** Formats a CurrencyAmount. | | ` https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#format(android.icu.math.BigDecimal,%20java.lang.StringBuffer,%20java.text.FieldPosition)(https://developer.android.com/reference/android/icu/math/BigDecimal number, https://developer.android.com/reference/java/lang/StringBuffer result, https://developer.android.com/reference/java/text/FieldPosition fieldPosition) ` **\[icu\]** Formats an ICU BigDecimal. | | ` https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#format(double,%20java.lang.StringBuffer,%20java.text.FieldPosition)(double number, https://developer.android.com/reference/java/lang/StringBuffer result, https://developer.android.com/reference/java/text/FieldPosition fieldPosition) ` Specialization of format. | | ` https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#format(java.math.BigDecimal,%20java.lang.StringBuffer,%20java.text.FieldPosition)(https://developer.android.com/reference/java/math/BigDecimal number, https://developer.android.com/reference/java/lang/StringBuffer result, https://developer.android.com/reference/java/text/FieldPosition fieldPosition) ` **\[icu\]** Formats a BigDecimal. | | ` https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#format(long,%20java.lang.StringBuffer,%20java.text.FieldPosition)(long number, https://developer.android.com/reference/java/lang/StringBuffer result, https://developer.android.com/reference/java/text/FieldPosition fieldPosition) ` Specialization of format. | | ` https://developer.android.com/reference/java/text/AttributedCharacterIterator` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#formatToCharacterIterator(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Formats an Object producing an `AttributedCharacterIterator`. | | ` https://developer.android.com/reference/android/icu/util/Currency` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getCurrency()() ` Returns the currency used to display currency amounts. | | ` https://developer.android.com/reference/android/icu/text/CurrencyPluralInfo` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getCurrencyPluralInfo()() ` **\[icu\]** Returns the current instance of CurrencyPluralInfo. | | ` https://developer.android.com/reference/android/icu/util/Currency.CurrencyUsage` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getCurrencyUsage()() ` **\[icu\]** Returns the strategy for rounding currency amounts. | | ` https://developer.android.com/reference/android/icu/text/DecimalFormatSymbols` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getDecimalFormatSymbols()() ` Returns a copy of the decimal format symbols used by this formatter. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getFormatWidth()() ` Returns the minimum number of characters in formatted output. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getGroupingSize()() ` Returns the primary grouping size in use. | | ` https://developer.android.com/reference/java/math/MathContext` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getMathContext()() ` **\[icu\]** Returns the `https://developer.android.com/reference/java/math/MathContext` being used to round numbers. | | ` https://developer.android.com/reference/android/icu/math/MathContext` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getMathContextICU()() ` **\[icu\]** Returns the `https://developer.android.com/reference/android/icu/math/MathContext` being used to round numbers. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getMaximumFractionDigits()() ` Returns the effective maximum number of integer digits after the decimal separator. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getMaximumIntegerDigits()() ` Returns the effective maximum number of digits before the decimal separator. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getMaximumSignificantDigits()() ` **\[icu\]** Returns the effective maximum number of significant digits displayed. | | ` byte` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getMinimumExponentDigits()() ` **\[icu\]** Returns the minimum number of digits printed in the exponent in scientific notation. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getMinimumFractionDigits()() ` Returns the effective minimum number of integer digits after the decimal separator. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getMinimumGroupingDigits()() ` **\[icu\]** Returns the minimum number of digits before grouping is triggered. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getMinimumIntegerDigits()() ` Returns the effective minimum number of digits before the decimal separator. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getMinimumSignificantDigits()() ` **\[icu\]** Returns the effective minimum number of significant digits displayed. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getMultiplier()() ` Returns the multiplier being applied to numbers before they are formatted. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getNegativePrefix()() ` **Affixes:** Gets the negative prefix string currently being used to format numbers. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getNegativeSuffix()() ` **Affixes:** Gets the negative suffix string currently being used to format numbers. | | ` char` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getPadCharacter()() ` **\[icu\]** Returns the character used for padding. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getPadPosition()() ` **\[icu\]** Returns the position used for padding. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getParseMaxDigits()() ` *This method was deprecated in API level 28. Setting max parse digits has no effect since ICU4J 59.* | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getPositivePrefix()() ` **Affixes:** Gets the positive prefix string currently being used to format numbers. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getPositiveSuffix()() ` **Affixes:** Gets the positive suffix string currently being used to format numbers. | | ` https://developer.android.com/reference/java/math/BigDecimal` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getRoundingIncrement()() ` **\[icu\]** Returns the increment to which numbers are being rounded. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getRoundingMode()() ` Returns the rounding mode being used to round numbers. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#getSecondaryGroupingSize()() ` **\[icu\]** Returns the secondary grouping size in use. | | ` int` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#hashCode()() ` Returns a hash code value for the object. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#isDecimalPatternMatchRequired()() ` **\[icu\]** Returns whether the presence of a decimal point must match the pattern. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#isDecimalSeparatorAlwaysShown()() ` Returns whether the decimal separator is shown on integers. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#isExponentSignAlwaysShown()() ` **\[icu\]** Returns whether the sign (plus or minus) is always printed in scientific notation. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#isGroupingUsed()() ` Returns whether or not grouping separators are being printed in the output. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#isParseBigDecimal()() ` Returns whether `https://developer.android.com/reference/android/icu/text/NumberFormat#parse(java.lang.String)` will always return a BigDecimal. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#isParseCaseSensitive()() ` **\[icu\]** Returns whether to force case (uppercase/lowercase) to match when parsing. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#isParseIntegerOnly()() ` Returns true if this format will parse numbers as integers only. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#isParseNoExponent()() ` **\[icu\]** Returns whether to ignore exponents when parsing. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#isParseStrict()() ` **\[icu\]** Returns whether strict parsing is in effect. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#isScientificNotation()() ` **\[icu\]** Returns whether scientific (exponential) notation is enabled on this formatter. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#isSignAlwaysShown()() ` **\[icu\]** Returns whether the sign is being shown on positive numbers. | | ` https://developer.android.com/reference/java/lang/Number` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#parse(java.lang.String,%20java.text.ParsePosition)(https://developer.android.com/reference/java/lang/String text, https://developer.android.com/reference/java/text/ParsePosition parsePosition) ` Returns a Long if possible (e.g., within the range \[Long.MIN_VALUE, Long.MAX_VALUE\] and with no decimals); otherwise, returns another type, such as a BigDecimal, BigInteger, or Double. | | ` https://developer.android.com/reference/android/icu/util/CurrencyAmount` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#parseCurrency(java.lang.CharSequence,%20java.text.ParsePosition)(https://developer.android.com/reference/java/lang/CharSequence text, https://developer.android.com/reference/java/text/ParsePosition parsePosition) ` Parses text from the given string as a CurrencyAmount. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setCurrency(android.icu.util.Currency)(https://developer.android.com/reference/android/icu/util/Currency currency) ` Sets the currency to be used when formatting numbers. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setCurrencyPluralInfo(android.icu.text.CurrencyPluralInfo)(https://developer.android.com/reference/android/icu/text/CurrencyPluralInfo newInfo) ` **\[icu\]** Sets a custom instance of CurrencyPluralInfo. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setCurrencyUsage(android.icu.util.Currency.CurrencyUsage)(https://developer.android.com/reference/android/icu/util/Currency.CurrencyUsage usage) ` **\[icu\]** Sets the currency-dependent strategy to use when rounding numbers. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setDecimalFormatSymbols(android.icu.text.DecimalFormatSymbols)(https://developer.android.com/reference/android/icu/text/DecimalFormatSymbols newSymbols) ` Sets the decimal format symbols used by this formatter. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setDecimalPatternMatchRequired(boolean)(boolean value) ` **\[icu\]** **Parsing:** This method is used to either *require* or *forbid* the presence of a decimal point in the string being parsed (disabled by default). | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setDecimalSeparatorAlwaysShown(boolean)(boolean value) ` **Separators:** Sets whether the decimal separator (a period in *en-US*) is shown on integers. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setExponentSignAlwaysShown(boolean)(boolean expSignAlways) ` **\[icu\]** **Scientific Notation:** Sets whether the sign (plus or minus) is always to be shown in the exponent in scientific notation. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setFormatWidth(int)(int width) ` **Padding:** Sets the minimum width of the string output by the formatting pipeline. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setGroupingSize(int)(int width) ` **Grouping:** Sets the primary grouping size (distance between grouping separators) used when formatting large numbers. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setGroupingUsed(boolean)(boolean enabled) ` **Grouping:** Sets whether grouping is to be used when formatting numbers. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setMathContext(java.math.MathContext)(https://developer.android.com/reference/java/math/MathContext mathContext) ` **\[icu\]** **Rounding and Digit Limits:** Sets the `https://developer.android.com/reference/java/math/MathContext` used to round numbers. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setMathContextICU(android.icu.math.MathContext)(https://developer.android.com/reference/android/icu/math/MathContext mathContextICU) ` **\[icu\]** **Rounding and Digit Limits:** Overload of `https://developer.android.com/reference/android/icu/text/DecimalFormat#setMathContext(java.math.MathContext)` for `https://developer.android.com/reference/android/icu/math/MathContext`. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setMaximumFractionDigits(int)(int value) ` **Rounding and Digit Limits:** Sets the maximum number of digits to display after the decimal separator. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setMaximumIntegerDigits(int)(int value) ` **Rounding and Digit Limits:** Sets the maximum number of digits to display before the decimal separator. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setMaximumSignificantDigits(int)(int value) ` **\[icu\]** **Rounding and Digit Limits:** Sets the maximum number of significant digits to be displayed. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setMinimumExponentDigits(byte)(byte minExpDig) ` **\[icu\]** **Scientific Notation:** Sets the minimum number of digits to be printed in the exponent. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setMinimumFractionDigits(int)(int value) ` **Rounding and Digit Limits:** Sets the minimum number of digits to display after the decimal separator. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setMinimumGroupingDigits(int)(int number) ` **\[icu\]** Sets the minimum number of digits that must be before the first grouping separator in order for the grouping separator to be printed. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setMinimumIntegerDigits(int)(int value) ` **Rounding and Digit Limits:** Sets the minimum number of digits to display before the decimal separator. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setMinimumSignificantDigits(int)(int value) ` **\[icu\]** **Rounding and Digit Limits:** Sets the minimum number of significant digits to be displayed. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setMultiplier(int)(int multiplier) ` Sets a number that will be used to multiply all numbers prior to formatting. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setNegativePrefix(java.lang.String)(https://developer.android.com/reference/java/lang/String prefix) ` **Affixes:** Sets the string to prepend to negative numbers. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setNegativeSuffix(java.lang.String)(https://developer.android.com/reference/java/lang/String suffix) ` **Affixes:** Sets the string to append to negative numbers. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setPadCharacter(char)(char padChar) ` **\[icu\]** **Padding:** Sets the character used to pad numbers that are narrower than the width specified in `https://developer.android.com/reference/android/icu/text/DecimalFormat#setFormatWidth(int)`. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setPadPosition(int)(int padPos) ` **\[icu\]** **Padding:** Sets the position where to insert the pad character when narrower than the width specified in `https://developer.android.com/reference/android/icu/text/DecimalFormat#setFormatWidth(int)`. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setParseBigDecimal(boolean)(boolean value) ` Whether to make `https://developer.android.com/reference/android/icu/text/NumberFormat#parse(java.lang.String)` prefer returning a `https://developer.android.com/reference/android/icu/math/BigDecimal` when possible. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setParseCaseSensitive(boolean)(boolean value) ` **\[icu\]** Specifies whether parsing should require cases to match in affixes, exponent separators, and currency codes. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setParseIntegerOnly(boolean)(boolean parseIntegerOnly) ` **Parsing:** Sets whether to ignore the fraction part of a number when parsing (defaults to false). This is functionally equivalent to calling `https://developer.android.com/reference/android/icu/text/DecimalFormat#setDecimalPatternMatchRequired(boolean)` and a pattern without a decimal point. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setParseMaxDigits(int)(int maxDigits) ` *This method was deprecated in API level 28. Setting max parse digits has no effect since ICU4J 59.* | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setParseNoExponent(boolean)(boolean value) ` **\[icu\]** Specifies whether to stop parsing when an exponent separator is encountered. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setParseStrict(boolean)(boolean parseStrict) ` **\[icu\]** Sets whether strict parsing is in effect. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setPositivePrefix(java.lang.String)(https://developer.android.com/reference/java/lang/String prefix) ` **Affixes:** Sets the string to prepend to positive numbers. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setPositiveSuffix(java.lang.String)(https://developer.android.com/reference/java/lang/String suffix) ` **Affixes:** Sets the string to append to positive numbers. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setRoundingIncrement(java.math.BigDecimal)(https://developer.android.com/reference/java/math/BigDecimal increment) ` **\[icu\]** **Rounding and Digit Limits:** Sets an increment, or interval, to which numbers are rounded. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setRoundingIncrement(android.icu.math.BigDecimal)(https://developer.android.com/reference/android/icu/math/BigDecimal increment) ` **\[icu\]** **Rounding and Digit Limits:** Overload of `https://developer.android.com/reference/android/icu/text/DecimalFormat#setRoundingIncrement(java.math.BigDecimal)`. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setRoundingIncrement(double)(double increment) ` **\[icu\]** **Rounding and Digit Limits:** Overload of `https://developer.android.com/reference/android/icu/text/DecimalFormat#setRoundingIncrement(java.math.BigDecimal)`. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setRoundingMode(int)(int roundingMode) ` **Rounding and Digit Limits:** Sets the `https://developer.android.com/reference/java/math/RoundingMode` used to round numbers. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setScientificNotation(boolean)(boolean useScientific) ` **\[icu\]** **Scientific Notation:** Sets whether this formatter should print in scientific (exponential) notation. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setSecondaryGroupingSize(int)(int width) ` **\[icu\]** **Grouping:** Sets the secondary grouping size (distance between grouping separators after the first separator) used when formatting large numbers. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setSignAlwaysShown(boolean)(boolean value) ` Sets whether to always shown the plus sign ('+' in *en*) on positive numbers. | | ` void` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#setSignificantDigitsUsed(boolean)(boolean useSignificantDigits) ` **\[icu\]** **Rounding and Digit Limits:** Sets whether significant digits are to be used in rounding. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#toLocalizedPattern()() ` Calls `https://developer.android.com/reference/android/icu/text/DecimalFormat#toPattern()` and converts the string to localized notation. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#toPattern()() ` Serializes this formatter object to a decimal format pattern string. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/DecimalFormat#toString()() ` Returns the default value of toString() with extra DecimalFormat-specific information appended to the end of the string. | ||
| From class ` https://developer.android.com/reference/android/icu/text/NumberFormat ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#clone()() ` Overrides clone. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Overrides equals. | | ` abstract https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#format(java.math.BigInteger,%20java.lang.StringBuffer,%20java.text.FieldPosition)(https://developer.android.com/reference/java/math/BigInteger number, https://developer.android.com/reference/java/lang/StringBuffer toAppendTo, https://developer.android.com/reference/java/text/FieldPosition pos) ` **\[icu\]** Formats a BigInteger. | | ` abstract https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#format(android.icu.math.BigDecimal,%20java.lang.StringBuffer,%20java.text.FieldPosition)(https://developer.android.com/reference/android/icu/math/BigDecimal number, https://developer.android.com/reference/java/lang/StringBuffer toAppendTo, https://developer.android.com/reference/java/text/FieldPosition pos) ` **\[icu\]** Formats an ICU BigDecimal. | | ` https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#format(java.lang.Object,%20java.lang.StringBuffer,%20java.text.FieldPosition)(https://developer.android.com/reference/java/lang/Object number, https://developer.android.com/reference/java/lang/StringBuffer toAppendTo, https://developer.android.com/reference/java/text/FieldPosition pos) ` Formats a number and appends the resulting text to the given string buffer. | | ` final https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#format(java.math.BigDecimal)(https://developer.android.com/reference/java/math/BigDecimal number) ` Convenience method to format a BigDecimal. | | ` abstract https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#format(double,%20java.lang.StringBuffer,%20java.text.FieldPosition)(double number, https://developer.android.com/reference/java/lang/StringBuffer toAppendTo, https://developer.android.com/reference/java/text/FieldPosition pos) ` Specialization of format. | | ` abstract https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#format(java.math.BigDecimal,%20java.lang.StringBuffer,%20java.text.FieldPosition)(https://developer.android.com/reference/java/math/BigDecimal number, https://developer.android.com/reference/java/lang/StringBuffer toAppendTo, https://developer.android.com/reference/java/text/FieldPosition pos) ` **\[icu\]** Formats a BigDecimal. | | ` final https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#format(java.math.BigInteger)(https://developer.android.com/reference/java/math/BigInteger number) ` **\[icu\]** Convenience method to format a BigInteger. | | ` final https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#format(android.icu.math.BigDecimal)(https://developer.android.com/reference/android/icu/math/BigDecimal number) ` **\[icu\]** Convenience method to format an ICU BigDecimal. | | ` final https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#format(double)(double number) ` Specialization of format. | | ` final https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#format(long)(long number) ` Specialization of format. | | ` https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#format(android.icu.util.CurrencyAmount,%20java.lang.StringBuffer,%20java.text.FieldPosition)(https://developer.android.com/reference/android/icu/util/CurrencyAmount currAmt, https://developer.android.com/reference/java/lang/StringBuffer toAppendTo, https://developer.android.com/reference/java/text/FieldPosition pos) ` **\[icu\]** Formats a CurrencyAmount. | | ` final https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#format(android.icu.util.CurrencyAmount)(https://developer.android.com/reference/android/icu/util/CurrencyAmount currAmt) ` **\[icu\]** Convenience method to format a CurrencyAmount. | | ` abstract https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#format(long,%20java.lang.StringBuffer,%20java.text.FieldPosition)(long number, https://developer.android.com/reference/java/lang/StringBuffer toAppendTo, https://developer.android.com/reference/java/text/FieldPosition pos) ` Specialization of format. | | ` static https://developer.android.com/reference/java/util/Locale` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getAvailableLocales()() ` Returns the list of Locales for which NumberFormats are available. | | ` https://developer.android.com/reference/android/icu/text/DisplayContext` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getContext(android.icu.text.DisplayContext.Type)(https://developer.android.com/reference/android/icu/text/DisplayContext.Type type) ` **\[icu\]** Get the formatter's DisplayContext value for the specified DisplayContext.Type, such as CAPITALIZATION. | | ` https://developer.android.com/reference/android/icu/util/Currency` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getCurrency()() ` Returns the `Currency` object used to display currency amounts. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getCurrencyInstance(java.util.Locale)(https://developer.android.com/reference/java/util/Locale inLocale) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getCurrencyInstance(android.icu.util.ULocale)(https://developer.android.com/reference/android/icu/util/ULocale inLocale) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static final https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getCurrencyInstance()() ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static final https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getInstance()() ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getInstance(java.util.Locale)(https://developer.android.com/reference/java/util/Locale inLocale) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getInstance(android.icu.util.ULocale,%20int)(https://developer.android.com/reference/android/icu/util/ULocale desiredLocale, int choice) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getInstance(java.util.Locale,%20int)(https://developer.android.com/reference/java/util/Locale inLocale, int style) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getInstance(android.icu.util.ULocale)(https://developer.android.com/reference/android/icu/util/ULocale inLocale) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static final https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getInstance(int)(int style) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getIntegerInstance(android.icu.util.ULocale)(https://developer.android.com/reference/android/icu/util/ULocale inLocale) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static final https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getIntegerInstance()() ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getIntegerInstance(java.util.Locale)(https://developer.android.com/reference/java/util/Locale inLocale) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` int` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getMaximumFractionDigits()() ` Returns the maximum number of digits allowed in the fraction portion of a number. | | ` int` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getMaximumIntegerDigits()() ` Returns the maximum number of digits allowed in the integer portion of a number. | | ` int` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getMinimumFractionDigits()() ` Returns the minimum number of digits allowed in the fraction portion of a number. | | ` int` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getMinimumIntegerDigits()() ` Returns the minimum number of digits allowed in the integer portion of a number. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getNumberInstance(android.icu.util.ULocale)(https://developer.android.com/reference/android/icu/util/ULocale inLocale) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static final https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getNumberInstance()() ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getNumberInstance(java.util.Locale)(https://developer.android.com/reference/java/util/Locale inLocale) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getPattern(android.icu.util.ULocale,%20int)(https://developer.android.com/reference/android/icu/util/ULocale forLocale, int choice) ` Returns the pattern for the provided locale and choice. | | ` static final https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getPercentInstance()() ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getPercentInstance(java.util.Locale)(https://developer.android.com/reference/java/util/Locale inLocale) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getPercentInstance(android.icu.util.ULocale)(https://developer.android.com/reference/android/icu/util/ULocale inLocale) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` int` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getRoundingMode()() ` Returns the rounding mode used in this NumberFormat. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getScientificInstance(android.icu.util.ULocale)(https://developer.android.com/reference/android/icu/util/ULocale inLocale) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getScientificInstance(java.util.Locale)(https://developer.android.com/reference/java/util/Locale inLocale) ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` static final https://developer.android.com/reference/android/icu/text/NumberFormat` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#getScientificInstance()() ` **NOTE:** New users are strongly encouraged to use `https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat. | | ` int` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#hashCode()() ` Returns a hash code value for the object. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#isGroupingUsed()() ` Returns true if grouping is used in this format. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#isParseIntegerOnly()() ` Returns true if this format will parse numbers as integers only. | | ` boolean` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#isParseStrict()() ` **\[icu\]** Returns whether strict parsing is in effect. | | ` https://developer.android.com/reference/java/lang/Number` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#parse(java.lang.String)(https://developer.android.com/reference/java/lang/String text) ` Parses text from the beginning of the given string to produce a number. | | ` abstract https://developer.android.com/reference/java/lang/Number` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#parse(java.lang.String,%20java.text.ParsePosition)(https://developer.android.com/reference/java/lang/String text, https://developer.android.com/reference/java/text/ParsePosition parsePosition) ` Returns a Long if possible (e.g., within the range \[Long.MIN_VALUE, Long.MAX_VALUE\] and with no decimals); otherwise, returns another type, such as a BigDecimal, BigInteger, or Double. | | ` https://developer.android.com/reference/android/icu/util/CurrencyAmount` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#parseCurrency(java.lang.CharSequence,%20java.text.ParsePosition)(https://developer.android.com/reference/java/lang/CharSequence text, https://developer.android.com/reference/java/text/ParsePosition pos) ` Parses text from the given string as a CurrencyAmount. | | ` final https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#parseObject(java.lang.String,%20java.text.ParsePosition)(https://developer.android.com/reference/java/lang/String source, https://developer.android.com/reference/java/text/ParsePosition parsePosition) ` Parses text from a string to produce a number. | | ` void` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#setContext(android.icu.text.DisplayContext)(https://developer.android.com/reference/android/icu/text/DisplayContext context) ` **\[icu\]** Set a particular DisplayContext value in the formatter, such as CAPITALIZATION_FOR_STANDALONE. | | ` void` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#setCurrency(android.icu.util.Currency)(https://developer.android.com/reference/android/icu/util/Currency theCurrency) ` Sets the `Currency` object used to display currency amounts. | | ` void` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#setGroupingUsed(boolean)(boolean newValue) ` Sets whether or not grouping will be used in this format. | | ` void` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#setMaximumFractionDigits(int)(int newValue) ` Sets the maximum number of digits allowed in the fraction portion of a number. | | ` void` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#setMaximumIntegerDigits(int)(int newValue) ` Sets the maximum number of digits allowed in the integer portion of a number. | | ` void` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#setMinimumFractionDigits(int)(int newValue) ` Sets the minimum number of digits allowed in the fraction portion of a number. | | ` void` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#setMinimumIntegerDigits(int)(int newValue) ` Sets the minimum number of digits allowed in the integer portion of a number. | | ` void` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#setParseIntegerOnly(boolean)(boolean value) ` Sets whether to ignore the fraction part of a number when parsing (defaults to false). | | ` void` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#setParseStrict(boolean)(boolean value) ` **\[icu\]** Sets whether strict parsing is in effect. | | ` void` | ` https://developer.android.com/reference/android/icu/text/NumberFormat#setRoundingMode(int)(int roundingMode) ` Set the rounding mode used in this NumberFormat. | ||
| From class ` https://developer.android.com/reference/java/text/Format ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/text/Format#clone()() ` Creates and returns a copy of this object. | | ` final https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/text/Format#format(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Formats an object to produce a string. | | ` abstract https://developer.android.com/reference/java/lang/StringBuffer` | ` https://developer.android.com/reference/java/text/Format#format(java.lang.Object,%20java.lang.StringBuffer,%20java.text.FieldPosition)(https://developer.android.com/reference/java/lang/Object obj, https://developer.android.com/reference/java/lang/StringBuffer toAppendTo, https://developer.android.com/reference/java/text/FieldPosition pos) ` Formats an object and appends the resulting text to a given string buffer. | | ` https://developer.android.com/reference/java/text/AttributedCharacterIterator` | ` https://developer.android.com/reference/java/text/Format#formatToCharacterIterator(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Formats an Object producing an `AttributedCharacterIterator`. | | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/text/Format#parseObject(java.lang.String)(https://developer.android.com/reference/java/lang/String source) ` Parses text from the beginning of the given string to produce an object. | | ` abstract https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/text/Format#parseObject(java.lang.String,%20java.text.ParsePosition)(https://developer.android.com/reference/java/lang/String source, https://developer.android.com/reference/java/text/ParsePosition pos) ` Parses text from a string to produce an object. | ||
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Public methods

### getInstance

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static CompactDecimalFormat getInstance (ULocale locale, 
                CompactDecimalFormat.CompactStyle style)
```

**NOTE:** New users are strongly encouraged to use
`https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat.

*** ** * ** ***

Creates a CompactDecimalFormat appropriate for a locale. The result may be affected by the number system in the locale, such as ar-u-nu-latn.

<br />

<br />

| Parameters ||
|---|---|
| `locale` | `ULocale`: the desired locale <br /> |
| `style` | `CompactDecimalFormat.CompactStyle`: the compact style <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/text/CompactDecimalFormat` | <br /> |

### getInstance

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static CompactDecimalFormat getInstance (Locale locale, 
                CompactDecimalFormat.CompactStyle style)
```

**NOTE:** New users are strongly encouraged to use
`https://developer.android.com/reference/android/icu/number/NumberFormatter` instead of NumberFormat.

*** ** * ** ***

Creates a CompactDecimalFormat appropriate for a locale. The result may be affected by the number system in the locale, such as ar-u-nu-latn.

<br />

<br />

| Parameters ||
|---|---|
| `locale` | `Locale`: the desired locale <br /> |
| `style` | `CompactDecimalFormat.CompactStyle`: the compact style <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/text/CompactDecimalFormat` | <br /> |

### parse

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Number parse (String text, 
                ParsePosition parsePosition)
```

Parsing is currently unsupported, and throws an UnsupportedOperationException.

<br />

| Parameters ||
|---|---|
| `text` | `String` <br /> |
| `parsePosition` | `ParsePosition` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/Number` | <br /> |

### parseCurrency

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CurrencyAmount parseCurrency (CharSequence text, 
                ParsePosition parsePosition)
```

Parsing is currently unsupported, and throws an UnsupportedOperationException.

<br />

| Parameters ||
|---|---|
| `text` | `CharSequence`: the text to parse <br /> |
| `parsePosition` | `ParsePosition`: input-output position; on input, the position within text to match; must have 0 \<= pos.getIndex() \< text.length(); on output, the position after the last matched character. If the parse fails, the position in unchanged upon output. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/util/CurrencyAmount` | a CurrencyAmount, or null upon failure <br /> |