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:

for most "everyday" calculations, Java's built-in primitive types provide
the fastest, simplest solution: operations on ints, longs,
floats, doubles are straightforward to program
and generally map directly on to low-level processor
instructions, allowing most to complete in the order of a nanosecond with any stored
numbers taking up a few bytes of memory;

for special cases, the BigInteger and BigDecimal classes
allow decimal numbers with an arbitrary number of digits to be stored and calculated
on, up to the limits of available memory; the time and memory requirements then depend
more heavily on the operation being performed and the number of digits involved, and the
code involved can be a little clumsier.