This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes preserve double precision Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "preserve double precision" Watch "preserve double precision" New topic

preserve double precision

Saritha Reddy

Joined: Jun 17, 2004
Posts: 8

I declared a variable double as

double d=5;

when I print it, I get as 5.0.I want 5.00.

Can some one help me how to preserve the precition

Thaks in advance
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
Check java.text.DecimalFormat class

Quaerendo Invenietis
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608

Tony Morris
Java Q&A (FAQ, Trivia)
Have you checked out Aspose?
subject: preserve double precision
It's not a secret anymore!