Фёдор Алексеев, 394, Calculator

Хитро:) Можно ещё использовать BigDecimal.

From Bloch, J., Effective Java, 2nd ed, Item 48:

The float and double types are particularly ill-suited for monetary calculations because it is impossible to represent 0.1 (or any other negative power of ten) as a float or  double exactly.

For example, suppose you have $1.03 and you spend 42c. How much money do you have left?

System.out.println(1.03 - .42);
prints out 0.6100000000000001.

The right way to solve this problem is to use BigDecimal, int or long for monetary calculations.