DecimalFormat (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Serializable, Cloneable
-
Nested Class Summary
Nested classes/interfaces declared in class NumberFormat
NumberFormat.Field, NumberFormat.Stylestatic classDefines constants that are used as attribute keys in the
AttributedCharacterIteratorreturned fromNumberFormat.formatToCharacterIteratorand as field identifiers inFieldPosition.static enum -
Field Summary
Fields declared in class NumberFormat
static final intField constant used to construct a FieldPosition object.
static final intField constant used to construct a FieldPosition object.
-
Constructor Summary
Constructors
-
Method Summary
voidApply the given pattern to this Format object.
voidApply the given pattern to this Format object.
clone()Standard override; no change in semantics.
booleanCompares the specified object with this
DecimalFormatfor equality.Formats a double to produce a string.
Format a long to produce a string.
Formats a number and appends the resulting text to the given string buffer.
Formats an Object producing an
AttributedCharacterIterator.Gets the currency used by this decimal format when formatting currency values.
Returns a copy of the decimal format symbols, which is generally not changed by the programmer or user.
intReturn the grouping size.
intReturns the maximum number of digits allowed in the fraction portion of a number during formatting.
intReturns the maximum number of digits allowed in the integer portion of a number during formatting.
intReturns the minimum number of digits allowed in the fraction portion of a number during formatting.
intReturns the minimum number of digits allowed in the integer portion of a number during formatting.
intGets the multiplier for use in percent, per mille, and similar formats.
inthashCode()Returns the hash code for this
DecimalFormat.booleanAllows you to get the behavior of the decimal separator with integers.
booleanReturns whether the
parse(java.lang.String, java.text.ParsePosition)method returnsBigDecimal.booleanisStrict()Returns
trueif this format will parse numbers strictly;falseotherwise.Parses text from the beginning of the given string to produce a
Number.voidSets the currency used by this number format when formatting currency values.
voidSets the decimal format symbols, which is generally not changed by the programmer or user.
voidsetDecimalSeparatorAlwaysShown(boolean newValue) Allows you to set the behavior of the decimal separator with integers.
voidsetGroupingSize(int newValue) voidsetMaximumFractionDigits(int newValue) Sets the maximum number of digits allowed in the fraction portion of a number during formatting.
voidsetMaximumIntegerDigits(int newValue) Sets the maximum number of digits allowed in the integer portion of a number during formatting.
voidsetMinimumFractionDigits(int newValue) Sets the minimum number of digits allowed in the fraction portion of a number during formatting.
voidsetMinimumIntegerDigits(int newValue) Sets the minimum number of digits allowed in the integer portion of a number during formatting.
voidsetMultiplier(int newValue) Sets the multiplier for use in percent, per mille, and similar formats.
voidvoidvoidsetParseBigDecimal(boolean newValue) Sets whether the
parse(java.lang.String, java.text.ParsePosition)method returnsBigDecimal.voidvoidvoidvoidsetStrict(boolean strict) Change the leniency value for parsing.
Synthesizes a localized pattern string that represents the current state of this Format object.
Synthesizes a pattern string that represents the current state of this Format object.
toString()Returns a string identifying this
DecimalFormat, for debugging.Methods declared in class NumberFormat
format, format, getAvailableLocales, getCompactNumberInstance, getCompactNumberInstance, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setGroupingUsed, setParseIntegerOnlySpecialization of format.
Specialization of format.
Returns an array of all locales for which the
get*Instancemethods of this class can return localized instances.Returns a currency format for the current default
FORMATlocale.Returns a currency format for the specified locale.
Returns a general-purpose number format for the current default
FORMATlocale.Returns a general-purpose number format for the specified locale.
Returns an integer number format for the current default
FORMATlocale.Returns an integer number format for the specified locale.
Returns a general-purpose number format for the current default
FORMATlocale.Returns a general-purpose number format for the specified locale.
Returns a percentage format for the current default
FORMATlocale.Returns a percentage format for the specified locale.
booleanReturns true if grouping is used in this format.
booleanReturns
trueif this format will parse numbers as integers only.Parses text from the beginning of the given string to produce a
Number.Parses text from the given string to produce an object.
voidSet whether or not grouping will be used in this format.
voidSets whether or not numbers should be parsed as integers only.
Methods declared in class Format
Formats an object to produce a string.
Parses text from the beginning of the given string to produce an object.
Methods declared in class Object
finalize, getClass, notify, notifyAll, wait, wait, waitprotected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(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 voidwait(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.
-
Constructor Details
-
DecimalFormat
-
DecimalFormat
-
DecimalFormat
-
-
Method Details
-
format
-
format
-
format
-
formatToCharacterIterator
-
parse
-
getDecimalFormatSymbols
-
setDecimalFormatSymbols
-
getPositivePrefix
-
setPositivePrefix
-
getNegativePrefix
-
setNegativePrefix
-
getPositiveSuffix
-
setPositiveSuffix
-
getNegativeSuffix
-
setNegativeSuffix
-
getMultiplier
-
setMultiplier
-
getGroupingSize
-
setGroupingSize
-
isDecimalSeparatorAlwaysShown
-
setDecimalSeparatorAlwaysShown
-
isStrict
-
setStrict
-
isParseBigDecimal
-
setParseBigDecimal
-
clone
-
equals
-
hashCode
-
toString
-
toPattern
-
toLocalizedPattern
-
applyPattern
-
applyLocalizedPattern
-
setMaximumIntegerDigits
-
setMinimumIntegerDigits
-
setMaximumFractionDigits
-
setMinimumFractionDigits
-
getMaximumIntegerDigits
-
getMinimumIntegerDigits
-
getMaximumFractionDigits
-
getMinimumFractionDigits
-
getCurrency
-
setCurrency
-
getRoundingMode
-
setRoundingMode
-