code: public static boolean existsUrl(final String aUrl) {
      try {
        final URL url = new URL(aUrl);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("HEAD");
        connection.connect();
        return connection.getResponseCode() == 200;
      } catch (IOException e) {
        return false;
      }
    }
docs: checks whether an url exists. uses head request to check.
  
  @param aUrl the url to check
  @return true if url exists else false.