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!

rounding off a float to two decimal places

HawkerHunterSep 11 2011 — edited Apr 4 2012
I want to make a function where I shall pass a float and and integer.
The float shall have to be rounded off to a value in the integer.
Can anyone please suggest how to round off a float.
E.g.: if the float is 12.56890 and I want to round it off to 2 decimal places, then it should be 12.57.
Regards
Hawker
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 2 2012
Added on Sep 11 2011
29 comments
5,939 views