From 9cdd8ae550fb626f77eba27aea8baa1293e1909a Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Tue, 25 Feb 2020 10:04:49 -0500 Subject: [PATCH] =?UTF-8?q?=E7=A7=91=E5=AD=A6=E8=AE=A1=E6=95=B0=E6=B3=95?= =?UTF-8?q?=E7=9A=84=E8=BD=AC=E6=8D=A2=E5=92=8C=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ossez/maths/BigDecimalDemoUnitTest.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/java-numbers/src/test/java/com/ossez/maths/BigDecimalDemoUnitTest.java b/java-numbers/src/test/java/com/ossez/maths/BigDecimalDemoUnitTest.java index 4d71c592c1..d5009b10e3 100644 --- a/java-numbers/src/test/java/com/ossez/maths/BigDecimalDemoUnitTest.java +++ b/java-numbers/src/test/java/com/ossez/maths/BigDecimalDemoUnitTest.java @@ -175,20 +175,19 @@ public class BigDecimalDemoUnitTest { @Test public void bigDecimalScientificNotation() { // Create a BigDecimal object - BigDecimal a; + BigDecimal bigNumber; // Create a String object - String s; + String numberStr; // Set precision to 5 - MathContext mc = new MathContext(5); + MathContext mc = new MathContext(6); - a = new BigDecimal("4536785E4", mc); + bigNumber = new BigDecimal(RandomStringUtils.randomNumeric(10)+"E5", mc); // apply toString() method - s = a.toString(); - - // print the result - System.out.println(s); + logger.info("{}", bigNumber.toString()); + logger.info("{}", bigNumber.toEngineeringString()); + logger.info("{}", bigNumber.toPlainString()); } }