So That I Can Remember
Tuesday, August 31, 2010
Rounding double to two decimal places in Java
This is the simplest way i found.
Double num = 2.554545;
DecimalFormat twoDForm = new DecimalFormat("#.##");
return Double.valueOf(twoDForm.format(num));
No comments:
Post a Comment
›
Home
View web version
No comments:
Post a Comment