code: public long getLong( int index ) {
        Object o = get( index );
        if( o != null ){
           return o instanceof Number ? ((Number) o).longValue() : (long) getDouble( index );
        }
        throw new JSONException( "JSONArray[" + index + "] is not a number." );
     }
docs: Get the long value associated with an index.
  
  @param index The index must be between 0 and size() - 1.
  @return The value.
  @throws JSONException If the key is not found or if the value cannot be
  converted to a number.