Here you can find the source of readFile(String fileNm)
public static ArrayList<String> readFile(String fileNm)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.ArrayList; public class Main { public static ArrayList<String> readFile(String fileNm) { ArrayList<String> lines = null; FileReader fr = null;//ww w .j av a2s. com BufferedReader br = null; try { fr = new FileReader(new File(fileNm)); br = new BufferedReader(fr); lines = new ArrayList<String>(); String line = null; while ((line = br.readLine()) != null) { lines.add(line); } } catch (Exception e) { e.printStackTrace(); } finally { if (fr != null) try { fr.close(); } catch (Exception ex) { } ; if (br != null) try { br.close(); } catch (Exception ex) { } ; } return lines; } }