code: public static boolean isValidUrl(String url) {
          try {
              if (Strings.isNullOrEmpty(url)) {
                  return false;
              }
              new URL(url);
              return true;
          } catch (MalformedURLException e) {
              return false;
          }
      }
docs: Check whether provided url string is a valid java {@link java.net.URL}
  
  @param url URL to be validated
  @return TRUE if URL is valid