// retrieves url with HEAD, measures how long it takes. public static long getTimeToHEAD(String url) { try { if (!url.contains("//")) url = "http://" + url; long startTime = now(); HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection(); con.setRequestMethod("HEAD"); con.getResponseCode(); return now()-startTime; } catch (Exception e) { return -1; } }