File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Double Value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Double Value" Watch "Double Value" New topic
Author

Double Value

Natraj Gudla
Ranch Hand

Joined: Feb 09, 2003
Posts: 34
Hi,
I have a double value which prints a lot of digits after the decimal.
how do i control the number of digits after the decimal.
regards
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

You can use the java.text.DecimalFormat class to prepare formatted Strings from your double value -- i.e.,

prints 123.456 .


[Jess in Action][AskingGoodQuestions]
 
Don't get me started about those stupid light bulbs.
 
subject: Double Value
 
Similar Threads
Multiplying double values
How to count the number of digits after decimal point in java?
Convert double (primitive) value to String
printf question
How to identify double length