bson/src/main/org/bson/BasicBSONObject.java
public int getInt(final String key, final int def) {
        Object foo = get(key);
        if (foo == null) {
            return def;
        }

        return toInt(foo);
    }
public int getInt(final String key, final int def) {
        Object foo = get(key);
        if (foo == null) {
            return def;
        }

        return toInt(foo);
    }
Returns the value of a field as an {@code int}.

@param key the field to look for
@param def the default to return
@return the field value (or default)