File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes round Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "round " Watch "round " New topic


deep rai
Ranch Hand

Joined: Oct 04, 2007
Posts: 56

I need to round eg: 16.490000000000002 to 16.49 (rounded up to the nearest 0.05) i tried this

considering 0.05 as round factor ,but its still the same. Any help is appreciated.
marc weber

Joined: Aug 31, 2004
Posts: 11343

Look at the java.text.DecimalFormat class.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
I agree. Here's the link:
subject: round
It's not a secret anymore!