DecimalFormat df = new DecimalFormat("#,###.00") in java

Viewed 1412
DecimalFormat df = new DecimalFormat("#,###.00"); 
double size=10.00;
BigDecimal t=new BigDecimal(size);
df.format(t);

When I give size=0.00 output will be like ".00". Output should be "0.00", any suggestions?

1 Answers

Change your pattern to DecimalFormat df = new DecimalFormat("#,##0.00");

Related