How money management needs care really is not interesting to use floating points, because arithmetic operations with them result in certain #.
The recommended data type for this is BigDecimal , where you can choose the level of precision you want. Unlike
float , which use the binary base and have problems storing fractional numbers,
BigDecimal is more appropriate due to the fact that manipulations occur through the use of the decimal base.
Note: Due to the imprecision problems already mentioned, it is always recommended to make use of the constructor using String as a parameter, as in the example:
BigDecimal bd = new BigDecimal("0.1");