code: public static String urlToHost(String url) {
  		String lcUrl = url.toLowerCase();
  		if(lcUrl.startsWith(DNS_SCHEME)) {
  			return lcUrl.substring(DNS_SCHEME.length());
  		}
  		for(String scheme : ALL_SCHEMES) {
  			if(lcUrl.startsWith(scheme)) {
  				int authorityIdx = scheme.length();
  
  				Matcher m = 
  					HOST_REGEX_SIMPLE.matcher(lcUrl.substring(authorityIdx));
  				if(m.find()) {
  					return m.group(1);
  				}
  			}
  		}
  		return url;
  	}
docs: Attempt to extract the hostname component of an absolute URL argument.
  @param url the url String from which to extract the hostname
  @return the hostname within the URL, or the url argument if the host
  cannot be found.