Home Help Java D DecimalFormat



DecimalFormat
Posted on: April 3, 2006 at 12:00 AM
java.text.DecimalFormat is the class that is used for converting the decimal numbers into Strings.

DecimalFormat

     

java.text.DecimalFormat is the class that is used for converting the decimal numbers into Strings. This class is also used for parsing the Strings back in to binary numbers. It works with a String pattern to describe the format of a number. This class is used with doubles, floats, longs and ints. DecimalFormat automatically rounds off  to the number of decimal places.
  
Handling Negatives:
It does not arrange the minus sign of negative numbers. This arrangement is done automatically.

Post-Processing:
DecimalFormat class does not exactly do what you want, For that we have to add our own post-processing on the String it produces. Pad to fixed length with StringTools.leftPad or StringTools. d">rightPad or StringTools.toLZ.

Parsing:
DecimalFormat class also parses the String values to extract ints, longs and doubles.

Related Tags for DecimalFormat:


More Tutorials from this section

Ask Questions?    Discuss: DecimalFormat  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.