That reference sheet has all the methods you will need as well as what they do and how they are called.
There is Math.round() that rounds a double:
10.9 --> 11.0
10.4 --> 10.0
If you want a certain number of decimal digits you can:
Multiply (for example) the number with 100, then round it with the above method and then divided again with 100:
10.123456 --> 1012.3456 --> 1012.00 --> 10.12
double d = Math.round(10.9);
System.out.println(d); //will print 11.0
double d = Math.round(10.4);
System.out.println(d); //will print 10.0
Reputation Points: 1014
Solved Threads: 446
Nearly a Senior Poster
Offline 3,259 posts
since Dec 2007