Here you can find the source of readFile(String fileName)
public static String readFile(String fileName) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileReader; import java.io.IOException; public class Main { public static String readFile(String fileName) throws IOException { String content;// w w w . j ava2 s.c o m File file = new File(fileName); FileReader reader = new FileReader(file); char[] chars = new char[(int) file.length()]; reader.read(chars); content = new String(chars); reader.close(); return content; } }