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 round Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "round " Watch "round " New topic
Author

round

deep rai
Ranch Hand

Joined: Oct 04, 2007
Posts: 56
hi,

I need to round eg: 16.490000000000002 to 16.49 (rounded up to the nearest 0.05) i tried this
Math.ceil(value/0.05)*0.05

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

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
sscce.org
 
wood burning stoves
 
subject: round
 
Similar Threads
coding problem about Sales Taxes
rounding off in java
Rounding off numbers?
Rounded up to the nearest 0.05
Rounding decimal number to nearest 0.05