Is one BigDecimal less than another BigDecimal - Java java.math

Java examples for java.math:BigDecimal Compare

Description

Is one BigDecimal less than another BigDecimal

Demo Code


//package com.java2s;
import java.math.BigDecimal;

public class Main {
    public static void main(String[] argv) throws Exception {
        BigDecimal d1 = new BigDecimal("1234");
        BigDecimal d2 = new BigDecimal("1234");
        System.out.println(lt(d1, d2));
    }//from  ww w .j a  va 2 s.c  om

    public static boolean lt(BigDecimal d1, BigDecimal d2) {
        return d1.compareTo(d2) < 0;
    }
}

Related Tutorials