how can i round a double variables in java into only two decimals?
Asked
Active
Viewed 76 times
2 Answers
0
yourNewFormatedDouble = new DecimalFormat("#.##").format(yourOldDoubleHere);

Lukas Novicky
- 921
- 1
- 19
- 44
0
DecimalFormat df = new DecimalFormat("0.00##");
String result = df.format(myDouble);

Mureinik
- 297,002
- 52
- 306
- 350