code: public int getInt(int index) throws JSONException {
      Object o = get(index);
      return o instanceof Number ? ((Number) o).intValue() : (int) getDouble(index);
    }
docs: Get the int value associated with an index.
  
  @param index
  The index must be between 0 and length() - 1.
  @return The value.
  @throws JSONException
  If the key is not found or if the value cannot be converted to a number. if the value cannot be converted to a number.