+ 2

How to round of float value to two decimal value in java?

program to round of float value to two decimal.

6th Jul 2017, 4:10 PM
Jaya Bharathi M
Jaya Bharathi M - avatar
2 Réponses
+ 12
// Use printf instead : float f = 12.56994f; System.out.printf("Value: %.2f", f); /* You can also use Math.round() for the same purpose */
6th Jul 2017, 4:20 PM
Dev
Dev - avatar