NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(2);// 2是显示的小数点后的显示的最多位数,末尾位四舍五入
double increaseValue = 1233.693;
String res1 = nf.format(increaseValue); //res1 = 1,233.69
//去掉千分位
nf.setGroupingUsed(false);
String res2 = nf.format(increaseValue); //res2 = 1233.69
网友评论