Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to keep 2 decimal places for double value

807607Nov 15 2006 — edited Nov 15 2006
Hi,

I need rounding function, which should round a double number till 2 digits, if there is no decimal part it should append 2 zero's in decimal places.
eg. 100 --- > 100.00
200.234 --> 200.23.

I tried with Number class. but it is returning string, from that string if I try to convert to double value, it is rounding off one digit.


Can any one help on this problem.

Thanks,
Suman.ch
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 13 2006
Added on Nov 15 2006
6 comments
641 views