import java.net.*; import java.io.*; class WHWWW { public static void main(String[] argv) throws IOException { try { URL u = new URL(argv[0]); URLConnection uC = u.openConnection(); BufferedInputStream ins = (BufferedInputStream)uC.getContent(); InputStreamReader isr = new InputStreamReader(ins); BufferedReader br = new BufferedReader(isr); String s = br.readLine(); if (s.indexOf("404") >= 0 || s.indexOf("403") >= 0) // 404 means page doesn't exist, 403 means page is not readable System.out.println("bad"); else System.out.println("good"); } catch (Exception e) { System.out.println("something is wrong with the network"); } // end of try-catch } // main } // WHWWW