Java Math MathContext.equals() 方法 Java Math BigInteger.xor() 方法 Java Math MathContext.getPrecision() 方法 Java Math MathContext.equals() 方法 package com.codingdict; import java.math.*; public class MathContextDemo { public static void main(String[] args) { // create 3 MathContext objects MathContext mc1, mc2, mc3; // assign context settings to mc1, mc2, mc3 mc1 = new MathContext(2); mc2 = new MathContext(2, RoundingMode.HALF_UP); mc3 = new MathContext(2, RoundingMode.HALF_DOWN); // create 2 boolean objects Boolean b1, b2; // compare context settings of mc1 with mc2, mc3 b1 = mc1.equals(mc2); b2 = mc1.equals(mc3); String str1 = "Context settings of mc1 and mc2 are equal is " + b1; String str2 = "Context settings of mc1 and mc3 are equal is " + b2; // print b1, b2 values System.out.println( str1 ); System.out.println( str2 ); } } Java Math BigInteger.xor() 方法 Java Math MathContext.getPrecision() 方法