public static boolean compare(String v1, String v2, CompareMode mode) {
        BigDecimal bd1;
        BigDecimal bd2;

        try {
            bd1 = new BigDecimal(v1);
            bd2 = new BigDecimal(v2);
            int ret = bd1.compareTo(bd2);
            switch (mode) {
                case LESS:
                    return ret < 0;
                case NOTLESS:
                    return ret >= 0;
                case GREATER:
                    return ret > 0;
                case NOTGREATER:
                    return ret <= 0;
                case EQUAL:
                    return ret == 0;
                default:
                    return false;
            }
        } catch (Exception e) {
            return false;
        }
    }
public static boolean compare ( String v1 , String v2 , CompareMode mode ) { BigDecimal bd1 ; BigDecimal bd2 ; try { bd1 = new BigDecimal ( v1 ) ; bd2 = new BigDecimal ( v2 ) ; int ret = bd1 . compareTo ( bd2 ) ; switch ( mode ) { case LESS : return ret < 0 ; case NOTLESS : return ret >= 0 ; case GREATER : return ret > 0 ; case NOTGREATER : return ret <= 0 ; case EQUAL : return ret == 0 ; default : return false ; } } catch ( Exception e ) { return false ; } }
Compare the input number by given mode The scale will depends on the
scale of input number when the result is indivisible

Any numeric string recognized by {@code BigDecimal} is supported.

@param v1 A valid number strings
@param v2 A valid number strings
@param mode The compare mode

@return the boolean compare result based on given mode; invalid mode or
value will return false

@see BigDecimal