The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Rounding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Rounding" Watch "Rounding" New topic


Rachel Kozlowski
Ranch Hand

Joined: Jan 14, 2009
Posts: 40
Hi Khalid and Rolf:

I need to know a way to round a double to a percentage. I want anything that is greater than 5 rounded up and anything less rounded down.

Example: 92.5 should be 93% and
91.2 should be 91%.

Any Thoughts?
Mourouganandame Arunachalam
Ranch Hand

Joined: Oct 29, 2008
Posts: 396
check BigDecimal class .... clue: ROUND_HALF_UP

Open Source leads to Open Mind
I agree. Here's the link:
subject: Rounding
It's not a secret anymore!