double, BigDecimal, or Fixed-Point: Getting Number Precision Right in Java
Why 0.1 + 0.2 isn't 0.3, when double is fine, when BigDecimal is mandatory, and when fixed-point long is fastest. A beginner-to-advanced guide to number precision in Java — with runnable code, real output, a benchmark, rounding modes, MathContext, and a decision table.