API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.text. DecimalFormat View Source
Author(s)
Mark Davis
Alan Liu
Since
Version
1.88 06/26/06
Serial
Hierarchy
 Object
      Format
          NumberFormat
              DecimalFormat
Implements
Subclasses
Description
public class DecimalFormat
  DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers.
Constructors
public DecimalFormat ()
  Creates a DecimalFormat using the default pattern and symbols for the default locale.
public DecimalFormat (String pattern)
  Creates a DecimalFormat using the given pattern and the symbols for the default locale.
public DecimalFormat (String pattern, DecimalFormatSymbols symbols)
  Creates a DecimalFormat using the given pattern and symbols.
Methods
Hide/Show inherited methods
pack-private void adjustForCurrencyDefaultFractionDigits ()
Adjusts the minimum and maximum fraction digits to values that are reasonable for the currency's default fraction digits.
public void applyLocalizedPattern (String pattern)
  Apply the given pattern to this Format object.
public void applyPattern (String pattern)
  Apply the given pattern to this Format object.
public Object clone () [Overrides NumberFormat]
Standard override; no change in semantics.
pack-private AttributedCharacterIterator createAttributedCharacterIterator (AttributedCharacterIterator iterators) [Inherited From Format]
  Creates an AttributedCharacterIterator containg the concatenated contents of the passed in AttributedCharacterIterators.
pack-private AttributedCharacterIterator createAttributedCharacterIterator (AttributedCharacterIterator iterator, Attribute key, Object value) [Inherited From Format]
  Creates an AttributedCharacterIterator with the contents of iterator and the additional attribute key value.
pack-private AttributedCharacterIterator createAttributedCharacterIterator (String s) [Inherited From Format]
  Creates an AttributedCharacterIterator for the String s.
pack-private AttributedCharacterIterator createAttributedCharacterIterator (String string, Attribute key, Object value) [Inherited From Format]
  Returns an AttributedCharacterIterator with the String string and additional key/value pair key, value.
public boolean equals (Object obj) [Overrides NumberFormat]
Overrides equals
publicfinal String format (double number) [Inherited From NumberFormat]
  Specialization of format.
public StringBuffer format (double number, StringBuffer result, FieldPosition fieldPosition) [Specified in NumberFormat]
  Formats a double to produce a string.
publicfinal String format (long number) [Inherited From NumberFormat]
  Specialization of format.
public StringBuffer format (long number, StringBuffer result, FieldPosition fieldPosition) [Specified in NumberFormat]
  Format a long to produce a string.
publicfinal String format (Object obj) [Inherited From Format]
  Formats an object to produce a string.
publicfinal StringBuffer format (Object number, StringBuffer toAppendTo, FieldPosition pos) [Overrides NumberFormat] [Specified in Format]
  Formats a number and appends the resulting text to the given string buffer.
public AttributedCharacterIterator formatToCharacterIterator (Object obj) [Overrides Format]
  Formats an Object producing an AttributedCharacterIterator.
publicstatic Locale getAvailableLocales () [Inherited From NumberFormat]
  Returns an array of all locales for which the get*Instance methods of this class can return localized instances.
public Currency getCurrency () [Overrides NumberFormat]
  Gets the currency used by this decimal format when formatting currency values.
publicfinalstatic NumberFormat getCurrencyInstance () [Inherited From NumberFormat]
Returns a currency format for the current default locale.
publicstatic NumberFormat getCurrencyInstance (Locale inLocale) [Inherited From NumberFormat]
Returns a currency format for the specified locale.
public DecimalFormatSymbols getDecimalFormatSymbols ()
  Returns a copy of the decimal format symbols, which is generally not changed by the programmer or user.
public int getGroupingSize ()
  Return the grouping size.
publicfinalstatic NumberFormat getInstance () [Inherited From NumberFormat]
  Returns a general-purpose number format for the current default locale.
publicstatic NumberFormat getInstance (Locale inLocale) [Inherited From NumberFormat]
  Returns a general-purpose number format for the specified locale.
publicfinalstatic NumberFormat getIntegerInstance () [Inherited From NumberFormat]
  Returns an integer number format for the current default locale.
publicstatic NumberFormat getIntegerInstance (Locale inLocale) [Inherited From NumberFormat]
  Returns an integer number format for the specified locale.
public int getMaximumFractionDigits () [Overrides NumberFormat]
  Gets the maximum number of digits allowed in the fraction portion of a number.
public int getMaximumIntegerDigits () [Overrides NumberFormat]
  Gets the maximum number of digits allowed in the integer portion of a number.
public int getMinimumFractionDigits () [Overrides NumberFormat]
  Gets the minimum number of digits allowed in the fraction portion of a number.
public int getMinimumIntegerDigits () [Overrides NumberFormat]
  Gets the minimum number of digits allowed in the integer portion of a number.
public int getMultiplier ()
  Gets the multiplier for use in percent, per mille, and similar formats.
public String getNegativePrefix ()
  Get the negative prefix.
public String getNegativeSuffix ()
  Get the negative suffix.
publicfinalstatic NumberFormat getNumberInstance () [Inherited From NumberFormat]
Returns a general-purpose number format for the current default locale.
publicstatic NumberFormat getNumberInstance (Locale inLocale) [Inherited From NumberFormat]
Returns a general-purpose number format for the specified locale.
publicfinalstatic NumberFormat getPercentInstance () [Inherited From NumberFormat]
Returns a percentage format for the current default locale.
publicstatic NumberFormat getPercentInstance (Locale inLocale) [Inherited From NumberFormat]
Returns a percentage format for the specified locale.
public String getPositivePrefix ()
  Get the positive prefix.
public String getPositiveSuffix ()
  Get the positive suffix.
public RoundingMode getRoundingMode () [Overrides NumberFormat]
  Gets the RoundingMode used in this DecimalFormat.
pack-privatefinalstatic NumberFormat getScientificInstance () [Inherited From NumberFormat]
Returns a scientific format for the current default locale.
pack-privatestatic NumberFormat getScientificInstance (Locale inLocale) [Inherited From NumberFormat]
Returns a scientific format for the specified locale.
public int hashCode () [Overrides NumberFormat]
Overrides hashCode
public boolean isDecimalSeparatorAlwaysShown ()
  Allows you to get the behavior of the decimal separator with integers.
public boolean isGroupingUsed () [Inherited From NumberFormat]
  Returns true if grouping is used in this format.
public boolean isParseBigDecimal ()
  Returns whether the DecimalFormat.parse(java.lang.String, java.text.ParsePosition) method returns BigDecimal.
public boolean isParseIntegerOnly () [Inherited From NumberFormat]
  Returns true if this format will parse numbers as integers only.
public Number parse (String source) throws ParseException [Inherited From NumberFormat]
  Parses text from the beginning of the given string to produce a number.
public Number parse (String text, ParsePosition pos) [Specified in NumberFormat]
  Parses text from a string to produce a Number.
public Object parseObject (String source) throws ParseException [Inherited From Format]
  Parses text from the beginning of the given string to produce an object.
publicfinal Object parseObject (String source, ParsePosition pos) [Inherited From NumberFormat] [Specified in Format]
  Parses text from a string to produce a Number.
public void setCurrency (Currency currency) [Overrides NumberFormat]
  Sets the currency used by this number format when formatting currency values.
public void setDecimalFormatSymbols (DecimalFormatSymbols newSymbols)
  Sets the decimal format symbols, which is generally not changed by the programmer or user.
public void setDecimalSeparatorAlwaysShown (boolean newValue)
  Allows you to set the behavior of the decimal separator with integers.
public void setGroupingSize (int newValue)
  Set the grouping size.
public void setGroupingUsed (boolean newValue) [Inherited From NumberFormat]
  Set whether or not grouping will be used in this format.
public void setMaximumFractionDigits (int newValue) [Overrides NumberFormat]
  Sets the maximum number of digits allowed in the fraction portion of a number.
public void setMaximumIntegerDigits (int newValue) [Overrides NumberFormat]
  Sets the maximum number of digits allowed in the integer portion of a number.
public void setMinimumFractionDigits (int newValue) [Overrides NumberFormat]
  Sets the minimum number of digits allowed in the fraction portion of a number.
public void setMinimumIntegerDigits (int newValue) [Overrides NumberFormat]
  Sets the minimum number of digits allowed in the integer portion of a number.
public void setMultiplier (int newValue)
  Sets the multiplier for use in percent, per mille, and similar formats.
public void setNegativePrefix (String newValue)
  Set the negative prefix.
public void setNegativeSuffix (String newValue)
  Set the negative suffix.
public void setParseBigDecimal (boolean newValue)
  Sets whether the DecimalFormat.parse(java.lang.String, java.text.ParsePosition) method returns BigDecimal.
public void setParseIntegerOnly (boolean value) [Inherited From NumberFormat]
  Sets whether or not numbers should be parsed as integers only.
public void setPositivePrefix (String newValue)
  Set the positive prefix.
public void setPositiveSuffix (String newValue)
  Set the positive suffix.
public void setRoundingMode (RoundingMode roundingMode) [Overrides NumberFormat]
  Sets the RoundingMode used in this DecimalFormat.
public String toLocalizedPattern ()
  Synthesizes a localized pattern string that represents the current state of this Format object.
public String toPattern ()
  Synthesizes a pattern string that represents the current state of this Format object.
Fields
Hide/Show inherited fields
pack-privatefinalstatic int currentSerialVersion = "4" [Overrides NumberFormat]
pack-privatefinalstatic int DOUBLE_FRACTION_DIGITS = "340"
pack-privatefinalstatic int DOUBLE_INTEGER_DIGITS = "309"
publicfinalstatic int FRACTION_FIELD = "1" [Inherited From NumberFormat]
  Field constant used to construct a FieldPosition object.
publicfinalstatic int INTEGER_FIELD = "0" [Inherited From NumberFormat]
  Field constant used to construct a FieldPosition object.
pack-privatefinalstatic int MAXIMUM_FRACTION_DIGITS = "2147483647"
pack-privatefinalstatic int MAXIMUM_INTEGER_DIGITS = "2147483647"
pack-privatefinalstatic long serialVersionUID = "864413376551465018" [Overrides NumberFormat]
Nested Classes
  NumberFormat.Field
Defines constants that are used as attribute keys in the AttributedCharacterIterator returned from NumberFormat.formatToCharacterIterator and as field identifiers in FieldPosition.
  Format.Field
Defines constants that are used as attribute keys in the AttributedCharacterIterator returned from Format.formatToCharacterIterator and as field identifiers in FieldPosition.
  Format.FieldDelegate
FieldDelegate is notified by the various Format implementations as they are formatting the Objects.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar