code: private static boolean isRedirect(int statusCode) {
          return statusCode == HttpURLConnection.HTTP_MOVED_PERM ||
                  statusCode == HttpURLConnection.HTTP_MOVED_TEMP ||
                  statusCode == HttpURLConnection.HTTP_SEE_OTHER;
      }
docs: checks if the given status code is a redirect (301, 302 or 303 response status code)