标签:
import java.math.BigDecimal;
public class BigDecimalTest {
public static void main(String[] args) {
BigDecimal bg1 = new BigDecimal("0.105");
BigDecimal bg2 = new BigDecimal(0.105);
System.out.println(bg1);
System.out.println(bg2);
System.out.println(bg1.setScale(2,BigDecimal.ROUND_HALF_UP));
System.out.println(bg2.setScale(2,BigDecimal.ROUND_HALF_UP));
}
}
标签:
原文地址:http://www.cnblogs.com/qingyuuu/p/4616577.html