What data type to use for money in Java?

questborn picture questborn · Nov 16, 2011 · Viewed 168.5k times · Source

What data type should you use for money in Java?

Answer

Buhake Sindi picture Buhake Sindi · Nov 16, 2011

Java has Currency class that represents the ISO 4217 currency codes. BigDecimal is the best type for representing currency decimal values.

Joda Money has provided a library to represent money.