Here you can find the source of isEqual(BigDecimal n1, BigDecimal n2, int precision)
public static boolean isEqual(BigDecimal n1, BigDecimal n2, int precision)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; public class Main { /**// ww w.jav a 2 s.c o m * Checks two BigDecimal with given precision - number of nulls after point. * * @return */ public static boolean isEqual(BigDecimal n1, BigDecimal n2, int precision) { BigDecimal alpha = BigDecimal.ONE.movePointLeft(precision); return n1.subtract(n2).abs().compareTo(alpha) <= 0; } }