aspose file tools*
The moose likes Beginning Java and the fly likes How do i round a double to two decimal places? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do i round a double to two decimal places?" Watch "How do i round a double to two decimal places?" New topic
Author

How do i round a double to two decimal places?

John Lockheart
Ranch Hand

Joined: Oct 13, 2006
Posts: 115
I've tried a couple of math formula's, and using java.text.decimalformatter buut, I'm not having much luck. I need something that not only works for decimals with a large amount of numbers after the decimal point. But also something that works for converting an int 30, to double 30.0 and than gives me 30.00...if possible. Is it?
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689


[ February 27, 2008: Message edited by: Kaydell Leavitt ]
John Lockheart
Ranch Hand

Joined: Oct 13, 2006
Posts: 115
Works great, thanks a lot.
 
Consider Paul's rocket mass heater.
 
subject: How do i round a double to two decimal places?