I use double values in my project and I would like to always show the first two decimal digits, even if them are zeros. I use this function for rounding and if the value I print
DecimalFormat is the easiest option to use:
double roundTwoDecimals(double d) { DecimalFormat twoDecimals = new DecimalFormat("#.##"); return Double.valueOf(twoDecimals.format(d)); }
Hope this solves your issue...