public static int readInt(final JSONObject jsonObject,final String key,final boolean required,final boolean notNull) throws JSONException {
  if (required) {
    return jsonObject.getInt(key);
  }
  if (notNull && jsonObject.isNull(key)) {
    throw new JSONException(String.format(Locale.US,NULL_VALUE_FORMAT_OBJECT,key));
  }
  int value=0;
  if (!jsonObject.isNull(key)) {
    value=jsonObject.getInt(key);
  }
  return value;
}

public static int readInt ( final JSONObject jsonObject , final String key , final boolean required , final boolean notNull ) throws JSONException { if ( required ) { return jsonObject . getInt ( key ) ; } if ( notNull && jsonObject . isNull ( key ) ) { throw new JSONException ( String . format ( Locale . US , NULL_VALUE_FORMAT_OBJECT , key ) ) ; } int value = 0 ; if ( ! jsonObject . isNull ( key ) ) { value = jsonObject . getInt ( key ) ; } return value ; }
reads the int value from the json object for specified tag .
