This example shows how we can use DecimalFormat to display double, float with 2 decimal places.

We can use the 2 decimal places colclusion value for printing or calculation also.

How to Round a Number to 2 Decimal Places

double input = 3.14159265359;
DecimalFormat df = new DecimalFormat("#.##");
df.format(input) // 3.14

Sample Input

60.580498

Sample output

60.58