Code example for BigInteger

Methods: compareTo, longValue

0
            } else { 
                return bd.longValue();
            } 
        } else if (num instanceof BigInteger) {
            BigInteger bi = (BigInteger) num;
            if (bi.compareTo(BIG_INTEGER_LONG_MAX) > 0 || bi.compareTo(BIG_INTEGER_LONG_MIN) < 0) {
                throw new _TemplateModelException(new Object[] {
                        "Number doesn't fit into a 64 bit signed integer (long): ", bi });
            } else { 
                return bi.longValue();
            } 
        } else if (num instanceof Long || num instanceof Integer || num instanceof Byte || num instanceof Short) {
            return num.longValue();
        } else { 
            // Should add Atomic* types in 2.4... 
            throw new _TemplateModelException(new Object[] { "Unsupported number type: ", num.getClass() });
        } 
    } 
     
    static class number_to_dateBI extends NumberBuiltIn {