List of utility methods to do BigDecimal Value Check
boolean | isPositive(BigDecimal number) is Positive return number.signum() == 1;
|
Boolean | isPositive(BigDecimal value) is Positive return value != null && value.compareTo(BigDecimal.ZERO) > 0;
|
boolean | isPrimeNumber(BigDecimal inBd) is Prime Number if (inBd == null || isNotZero(inBd.remainder(BigDecimal.ONE))) { return false; return isPrimeNumber(inBd.toBigInteger()); |
boolean | isProfitable(BigDecimal ask, BigDecimal bid, BigDecimal fee, BigDecimal minProfit) Returns if a combined bid/ask operation is profitable for the specified fees and desired profit BigDecimal profit = getProfit(ask, bid, fee); boolean result = profit.compareTo(minProfit) >= 0; return result; |
boolean | isSameValue(final BigDecimal val1, final BigDecimal val2) is Same Value return val1 == null && val2 == null || val1 != null && val2 != null && val1.compareTo(val2) == 0; |
boolean | isStrictementNegatif(BigDecimal pNombre) is Strictement Negatif return null != pNombre && 0 < ZERO.compareTo(pNombre);
|
boolean | isUnscaledValueEqualsOriginal(BigDecimal bigDecimal, BigInteger bigInteger) is Unscaled Value Equals Original return bigDecimal.equals(new BigDecimal(bigInteger)); |
boolean | isValidDecimal(BigDecimal bd) is Valid Decimal BigInteger usv = bd.unscaledValue(); long usvl = usv.longValue(); return usv.equals(BigInteger.valueOf(usvl)); |
boolean | isValidLongitude(BigDecimal value) is Valid Longitude BigDecimal min = new BigDecimal("31.2"); BigDecimal max = new BigDecimal("38.9"); return value != null && value.compareTo(min) >= 0 && value.compareTo(max) <= 0; |
boolean | isValueEquals(BigDecimal decimal1, BigDecimal decimal2) e.g. if (decimal1 == null && decimal2 == null) return true; if (decimal1 == null && decimal2 != null) return false; if (decimal1 != null && decimal2 == null) return false; return cutInvalidSacle(decimal1).equals(cutInvalidSacle(decimal2)); |