Compare two BigDecimal

intcompareTo(BigDecimal val)Compares this BigDecimal with the specified BigDecimal.
booleanequals(Object x)Compares this BigDecimal with the specified Object for equality.

compareTo(BigDecimal val) returns:

-1this BigDecimal is numerically less than val
0this BigDecimal is numerically equal to val
1this BigDecimal is numerically greater than val.

import java.math.BigDecimal;

public class Main {
    public static void main(String[] args) {
        BigDecimal first = new BigDecimal(-1f);
        BigDecimal second = new BigDecimal(10f);

The output:

-1  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.