How to check if BigDecimal variable == 0 in java?

I have the following code in Java;

BigDecimal price; // assigned elsewhere

if (price.compareTo(new BigDecimal("0.00")) == 0) {
    return true;
}

What is the best way to write the if condition?

12 Answers
12

Leave a Comment