Round number to fewer decimals

There are severals ways to accomplish this. The example below shows two of them.
The second example is only possible if you run Java version 1.5 or later, which by now probably isn’t a problem.

The output of either one of the above rounding methods is:

Search for more Java info on this site here:
Custom Search

Please type any questions here.