The method [compareTo](<https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html#compareTo-java.math.BigDecimal->) should be used to compare BigDecimals:

BigDecimal a = new BigDecimal(5);
a.compareTo(new BigDecimal(0));    // a is greater, returns 1
a.compareTo(new BigDecimal(5));    // a is equal, returns 0
a.compareTo(new BigDecimal(10));   // a is less, returns -1

Commonly you should not use the [equals](<https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html#equals-java.lang.Object->) method since it considers two BigDecimals equal only if they are equal in value and also scale:

BigDecimal a = new BigDecimal(5);
a.equals(new BigDecimal(5));       // value and scale are equal, returns true
a.equals(new BigDecimal(5.00));    // value is equal but scale is not, returns false