0

Rounding double to two decimal places in Java

in
This is the simplest way i found.

Double num = 2.554545;

DecimalFormat twoDForm = new DecimalFormat("#.##");
return Double.valueOf(twoDForm.format(num));

|

Copyright © 2009 So That I Can Remember All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive.