提供精确的小数位四舍五入处理

来源:互联网 发布:非农数据股市 编辑:程序博客网 时间:2024/06/05 11:59
public static double getRound(){
          double b=20.1265;
          BigDecimal decimal = new BigDecimal(b);
          double d = decimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
          return d;
      }
原创粉丝点击