Here you can find the source of getHost(String link)
public static String getHost(String link)
//package com.java2s; import java.net.MalformedURLException; import java.net.URL; public class Main { public static String getHost(String link) { URL url;/*from w ww. j a v a 2s .c om*/ String host = ""; try { url = new URL(link); host = url.getHost(); } catch (MalformedURLException e) { } return host; } }