好好看看这个类java.text.NumberFormat就能找到答案NumberFormat nf = new NumberFormat();
nf.setMaximumFractionDigits(1);
nf.setMinimumFractionDigits(1);
nf.format(3.00000);
nf.setMaximumFractionDigits(1);
nf.setMinimumFractionDigits(1);
nf.format(3.00000);
调试欢乐多
nf.set×××()方法//可以看看sun的文档,里面定义了四种set×××()方法,可以限制 格式化的形式
nf.format(要格式化的数据);//注意,format()方法返回String类型redstarstar的方法虽然巧妙,但是不是很通用