public static int getInt(JsonObject object, String field, int defaultValue) {
        final JsonValue value = object.get(field);
        if (value == null || value.isNull()) {
            return defaultValue;
        } else {
            return value.asInt();
        }
    }
public static int getInt ( JsonObject object , String field , int defaultValue ) { final JsonValue value = object . get ( field ) ; if ( value == null || value . isNull ( ) ) { return defaultValue ; } else { return value . asInt ( ) ; } }
Returns a field in a Json object as an int.

@param object the Json Object
@param field the field in the Json object to return
@param defaultValue a default value for the field if the field value is null
@return the Json field value as an int