BigDecimal.compareTo

BigDecimal.compareTo

Class Overview | Class Members | This Package | All Packages

Syntax
public int compareTo( BigDecimal val )
Description
Returns -1, 0 or 1 as this number is less than, equal to, or greater than val. Two BigDecimals that are equal in value but have a different scale (e.g., 2.0, 2.00) are considered equal by this method. This method is provided in preference to individual methods for each of the six boolean comparison operators (<, ==, >, >=, !=, <=). The suggested idiom for performing these comparisons is: (x.compareTo(y) 0), where is one of the six comparison operators.