Here you can find the source of getResponseCode(String urlS)
public static int getResponseCode(String urlS) throws java.net.MalformedURLException, java.io.IOException, java.net.ProtocolException
//package com.java2s; //License from project: Open Source License import java.net.URL; import java.net.HttpURLConnection; public class Main { public static int getResponseCode(String urlS) throws java.net.MalformedURLException, java.io.IOException, java.net.ProtocolException { URL url = new URL(urlS); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); return connection.getResponseCode(); }// w ww .ja v a 2 s. c o m }