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.
Written by Neil Coffey. Copyright © Javamex UK 2011. All rights reserved. If you have any feedback on the Java collections tutorials in this section or about the content of this site in general, please leave a message on the Javamex forum.