code: static boolean hasHits(@Nullable JSONObject jsonObject) {
          if (jsonObject == null) {
              return false;
          }
  
          JSONArray resultHits = jsonObject.optJSONArray("hits");
          if (resultHits == null) {
              return false;
          }
  
          for (int i = 0; i < resultHits.length(); ++i) {
              JSONObject hit = resultHits.optJSONObject(i);
              if (hit != null) {
                  return true;
              }
          }
          return false;
      }
docs: Checks if a response's json contains at least one hit.
  
  @param jsonObject the JSONObject to check.
  @return {@code true} if it contains a hits array with at least one non null element.