I have BiGDecimal price
and i need to check if it is in some range.
For example should be 3 conditions:
if (price >= 0 and price <=500) {
....
} else if (price >=500 && price <=1000) {
....
} else if (price > 1000) {
....
}
How to do it right using BigDecimal type.
That is achievable using the .compareTo() method. For instance:
Quoting (and paraphrasing) from the JavaDoc:
Cheers,