Package Name: java.math
Description
The java.math package of Java API provides classes for performing arbitrary-precision integer arithmetic (BigInteger) and arbitrary-precision decimal arithmetic (BigDecimal). The BigInteger class is somewhat analogous to the primitive Integer types except that it provides arbitrary precision, thus the operations on BigIntegers do not overflow or lose precision In addition to standard arithmetic operations, BigInteger provides modular arithmetic, GCD calculation, primality testing, prime generation, bit manipulation, and a few other miscellaneous operations. BigDecimal provides arbitrary-precision signed decimal numbers suitable for currency calculations and the like. BigDecimal gives the user complete control over rounding behavior, allowing the user to choose from a comprehensive set of eight rounding modes. These two classes is recommended in in dealing with calculation that involves money which requires high level precision.
java.math classes
The following are the classes that belongs to the java.math package:
- BigDecimal
- BigInteger
- MathContext