Java Math Bigdecimal Remainder_mc Java Math BigDecimal.remainder() 方法 Java Math BigDecimal.round() 方法 Java Math Bigdecimal Remainder_mc package com.codingdict; import java.math.*; public class BigDecimalDemo { public static void main(String[] args) { // create 3 BigDecimal Objects BigDecimal bg1, bg2, bg3; MathContext mc = new MathContext(2); // 2 precision bg1 = new BigDecimal("-144.144"); bg2 = new BigDecimal("16.12"); // bg2 divided by bg1 using mc gives bg3 as remainder bg3 = bg1.remainder(bg2, mc); String str = "The remainder is " + bg3; // print the value of bg3 System.out.println( str ); } } Java Math BigDecimal.remainder() 方法 Java Math BigDecimal.round() 方法