import java.net.*;
import java.io.*;

class CheckURL {
   static BufferedReader myInput;
    static  FileReader myFile;  
   public static void main (String[] args) {

                     try{
     String nomeurl;
     myFile = new  FileReader("list.txt");
     myInput = new BufferedReader(myFile);
          while ( myInput.ready() ){
 
                      nomeurl=myInput.readLine();
      try {
         URL theURL = new URL (nomeurl);
         System.out.println("Testing "+nomeurl);
      try {
         URLConnection con=  theURL.openConnection();
            con.getContent();
            String temp=con.getHeaderField(0);
         System.out.println("Header "+temp);
            int fileNotFound=temp.indexOf("Not Found");
            if ( fileNotFound >=0 )
          System.out.println("***********Bad link***************");
            }catch(IOException e){  
         System.out.println("***********Bad link***************");
            }
      } catch (MalformedURLException e) {
         System.out.println("Malformed URL Exception "+e);
             }
   }
                    }catch(Exception e2){ }   
}
}
