Name

MathContext

Synopsis

This simple class represents a precision (number of significant digits) and a RoundingMode to be used in BigDecimal arithmetic. The constants are predefined MathContext objects that can be used to select unlimited precision arithmetic or to select specific operating modes that match decimal floating-point modes defined by the IEEE 754R standard.

java.math.MathContext

Figure 11-3. java.math.MathContext

public final class MathContext implements Serializable {
// Public Constructors
     public MathContext(int setPrecision);  
     public MathContext(String val);  
     public MathContext(int setPrecision, RoundingMode setRoundingMode);  
// Public Constants
     public static final MathContext DECIMAL128;  
     public static final MathContext DECIMAL32;  
     public static final MathContext DECIMAL64;  
     public static final MathContext UNLIMITED;  
// Public Instance Methods
     public int getPrecision( );  
     public RoundingMode getRoundingMode( );  
// Public Methods Overriding Object
     public boolean equals(Object x);  
     public int hashCode( );  
     public String toString( );  
}

Passed To

Too many methods to list.

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.