1、百分比转为BigDecimal小数
String percent="66.60%"; percent=percent.replace("%",""); Float f = Float.valueOf(percent) / 100; BigDecimal decimal = new BigDecimal(f); System.out.println(decimal);//-0.66600000858306884765625
2、BigDecimal小数转为百分比 DecimalFormat df = new DecimalFormat("0.00%"); BigDecimal d=new BigDecimal(0.666); String percent=df.format(d);
标签:百分比,Java,BigDecimal,percent,互转,new,小数 From: https://www.cnblogs.com/liujian1225/p/17072852.html