As mentioned in one of the comments on your original question, this issue has been covered on StackExchange: http://stackoverflow.com/questions/8148684/what-is-the-best-data-type-to-use-for-money-in-java-app

Basically, floating point types should never be used to represent currencies, and like most languages Java has a more appropriate type.
[Oracle's own documentation on primitives][1] suggests using [BigDecimal][2].


  [1]: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
  [2]: http://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html