java-BigDecimal百位取整和科学记数法转换
String num = "12451";
BigDecimal bd = new BigDecimal(num);
bd = bd.setScale(-2, BigDecimal.ROUND_DOWN);
System.out.println("向下百位取整后:" + bd.intValue());
bd = new BigDecimal(num);
bd = bd.setScale(-2, BigDecimal.ROUND_UP);
System.out.println("向上百位取整后:" + bd.intValue());
BigDecimal bigDecimal = new BigDecimal("10000")
.multiply(new BigDecimal("0.35"))
.setScale(-2, BigDecimal.ROUND_DOWN);
System.out.println("bigDecimal = " + bigDecimal.toString());
System.out.println("bigDecimal = " + bigDecimal.toPlainString());
2.输出结果: