Here you can find the source of checkUrl(String inputUrlString)
public static boolean checkUrl(String inputUrlString) throws IOException
//package com.java2s; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static boolean checkUrl(String inputUrlString) throws IOException { URL url = new URL(inputUrlString); return checkUrl(url); }/*from w w w . ja va 2s. co m*/ public static boolean checkUrl(URL inputUrl) throws IOException { HttpURLConnection huc = (HttpURLConnection) inputUrl.openConnection(); huc.setRequestMethod("GET"); huc.connect(); if (HttpURLConnection.HTTP_OK == huc.getResponseCode()) { return true; } return false; } }