r/javahelp • • Sep 02 '20

Unsolved Math.round() rounding properties

Good morning Reddit, So I’m using math round to round some ints. Everything is fine except that if I try to round 445 it rounds to 450. This behavior is fine and acceptable but I’m trying to round to the hundredth digit. This means I want 445 to become 500 from going 445 to 450 and then 500. Is this possible with math round and anyone knows how? I’ve already been on google and stackoverflow but can’t find nothing that worked...

Thanks in advance!

23 Upvotes

7 comments sorted by

View all comments

1

u/bhaskargupta98 Sep 02 '20

You can use Serialiser or properties to define the order to which it should round off As you are already using inbuilt libraries then why to add slightest of mathematics