DecimalFormat df = new DecimalFormat (“#,###.00”) in Java… here is a solution to the problem.
DecimalFormat df = new DecimalFormat (“#,###.00”) in Java
DecimalFormat df = new DecimalFormat("#,###.00");
double size=10.00;
BigDecimal t=new BigDecimal(size);
df.format(t);
When I give size=0.00, the output will be something like “.00”.
The output should be “0.00”, any suggestions?
Solution
change the mode to DecimalFormat df = new DecimalFormat("#,##0.00");