Java Utililty Methods Number Compare

List of utility methods to do Number Compare

Description

The list of methods to do Number Compare are organized into topic(s).

Method

booleancompareValues(String value, String type, Object obj)
compare Values
if (value == null && obj == null)
    return true;
if (type.equals("int")) {
    Integer val = Integer.valueOf(Double.valueOf(value).intValue());
    return obj.equals(val);
if (type.equals("double")) {
    Double val = Double.valueOf(value);
...
BigDecimalgetCrosstabRowColumnValue(String groupIdentifier, Map crosstabInfoMap, Object executorUnitId, String financesBankId, String companyNumber, String accountNumber)
get crosstab info value
BigDecimal rowColumnValue = null;
String key = null;
if (crosstabInfoMap != null) {
    if (BALANCES_GROUP_KEY.equals(groupIdentifier)) {
        key = composeBalancesBankAccountKey(financesBankId, companyNumber, accountNumber);
    } else if (DEPOSIT_MORNING_GROUP_KEY.equals(groupIdentifier)) {
        key = composeMorningDepositsKey(executorUnitId.toString(), financesBankId, companyNumber,
                accountNumber);
...
BigDecimalgetDifficulty(long compactTarget)
Returns PoW difficulty (bdiff) for the target specified in a compact form known as "bits" in Bitcoin Core.
double maxbody = Math.log(0x00ffff);
double scaland = Math.log(256);
double diff = Math.exp(maxbody - Math.log(compactTarget & 0x00ffffff)
        + scaland * (0x1d - ((compactTarget & 0xff000000) >> 24)));
return BigDecimal.valueOf(diff);
ComparabletoPrimaryValue(Comparable comp)
to Primary Value
if (comp instanceof BigDecimal) {
    BigDecimal big = (BigDecimal) comp;
    int scale = big.scale();
    if (scale == 0) {
        try {
            return big.longValueExact();
        } catch (ArithmeticException e) {
            return big;
...