BigDecimal – BigAnnoyance
Nils got it right nearly three years ago, but it’s still very much broken here in 2009.
A calculation as simple as (289898-54545) / 54545 will throw a fun java.lang.ArithmeticException error.
It’s a good test calculation, because the resulting number, 4.314840957007975066458887157393[...], is a good precision test, and sure enough, it will cause an error every time. Get around it with a scale (in this case 10), and a BigDecimal.ROUND_HALF_UP RoundingMode.