Java Math BigDecimal.subtract() 方法 Java Math BigDecimal.stripTrailingZeros() 方法 Java Math Bigdecimal_subtract_mc Java Math BigDecimal.subtract() 方法 package com.codingdict; import java.math.*; public class BigDecimalDemo { public static void main(String[] args) { // create 3 BigDecimal objects BigDecimal bg1, bg2, bg3; bg1 = new BigDecimal("100.123"); bg2 = new BigDecimal("50.56"); // subtract bg1 with bg2 and assign result to bg3 bg3 = bg1.subtract(bg2); String str = "The Result of Subtraction is " + bg3; // print bg3 value System.out.println( str ); } } Java Math BigDecimal.stripTrailingZeros() 方法 Java Math Bigdecimal_subtract_mc