bson/src/main/org/bson/BasicBSONObject.java
public int getInt(final String key) {
        Object o = get(key);
        if (o == null) {
            throw new NullPointerException("no value for: " + key);
        }

        return toInt(o);
    }
public int getInt(final String key) {
        Object o = get(key);
        if (o == null) {
            throw new NullPointerException("no value for: " + key);
        }

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

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