File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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)
I agree. Here's the link:
subject: preserve double precision
It's not a secret anymore!