Comparing BigDecimals
Surprising behaviour
What result do you expect from this code?
It does not look suspicious and you would suspect it to simply render true, right?
Wrong!
Unfortunately, this prints out a big red false.
JavaDoc to the rescue
As you may read in the JavaDoc:
Mystery solved
Oh, so scale needs to be the same as well. How intuitive!
Solution
If what you really wanted is to compare BigDecimals as values and not as objects you should have used compareTo method:
TLDR;
When comparing BigDecimals use compareTo instead of equals.