#与0的区别:
#:没有则为空
0:没有则补0
final DecimalFormat df = new DecimalFormat("0.##");
final String str1 = df.format(a);
final DecimalFormat df = new DecimalFormat("0.00");
final String str1 = df.format(a);
执行结果:
3.1
3.10
参考:new DecimalFormat("0.##")与new DecimalFormat("0.00")的区别