Solution 1:

You may also pass the float value, and use:

String.format("%.2f", floatValue);

Documentation

Solution 2:

Take a look at DecimalFormat. You can easily use it to take a number and give it a set number of decimal places.

Edit: Example