Round a Double to Two Decimal Places in Java

In this tutorial, we will explore some of the different ways to round a double to two decimal places in Java.


Round Number to Two Decimal Place using Math.round()

The easiest way to round a number to a specific decimal place in Java is to use the Math.round() method. Multiply the number by 100 then divide the result by 100 to round to two decimal places like this:


double dbl = Math.round(85.3453 * 100.0) / 100.0;