本文介绍了没有E的Java BigDecimal的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一个BigDecimal变量I have a BigDecimal variableBigDecimal x = new BigDecimal("5521.0000000001");公式:x = x.add(new BigDecimal("-1") .multiply(x.divideToIntegralValue(new BigDecimal("1.0"))));我想删除整数部分,以获得值 x =( 0.0000000001),但我的新值是1E-10而不是0.0000000001。I want to remove the integer part, to get the value x = ("0.0000000001"), but my new value is 1E-10 and not the 0.0000000001.推荐答案要获得 String 表示 BigDecimal 而没有指数部分,您可以使用 BigDecimal。 toPlainString() 。在您的示例中:To get a String representation of the BigDecimal without the exponent part, you can useBigDecimal.toPlainString(). In your example:BigDecimal x = new BigDecimal("5521.0000000001");x = x.add(new BigDecimal("-1"). multiply(x.divideToIntegralValue(new BigDecimal("1.0"))));System.out.println(x.toPlainString());打印0.0000000001 这篇关于没有E的Java BigDecimal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!