Checks if a BigDecimal is with in a tolerance value
private static boolean isWithinTolerance(BigDecimal amount, BigDecimal tolerance) { | |
return (amount.compareTo(tolerance.negate()) > 0 && amount.compareTo(tolerance) < 0) | |
|| amount.abs().compareTo(tolerance) == 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment