public static String readFile(File f)
    {
        FileReader fr = null;
        BufferedReader br = null;
        char[] buffer = new char[1024];
        StringBuilder sb = new StringBuilder();
        int readnum = -1;
        
        try {
            fr = new FileReader(f);
            br = new BufferedReader(fr);
            
            for (;;) {
                readnum = br.read(buffer, 0, 1024);
                if (readnum == -1) {
                    break;
                }
                sb.append(buffer, 0, readnum);
            }            
            br.close();
            fr.close();
        } catch (FileNotFoundException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        
        return sb.toString();
    }