You do NOT use double to represent money. Not ever. Use java.math.BigDecimal
instead.
Then you can specify how exactly to do rounding (which is sometimes dictated by law in financial applications!) and don’t have to do stupid hacks like this epsilon thing.
Seriously, using floating point types to represent money is extremely unprofessional.