Mathematical operations in Java

This section looks at how to perform various types of calculation in Java. Depending on your needs, there are essentially two "frameworks" for doing calculations:

Calculations with primitive types

On the next and subsequent pages, we look at floating point primitive operations in Java: that is, operations on the float and double data types.

Calculations with BigInteger and BigDecimal

For more specialist applications, we later look at the BigInteger and BigDecimal classes, which allow representation of— and calculations on— numbers with an arbitrary number of digits. We include a look at the performance of BigInteger/BigDecimal operations, in particular an analysis of the performance of multiplication.