Here you can find the source of readFile(String filename, boolean print)
public static List<String> readFile(String filename, boolean print)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readFile(String filename, boolean print) { List<String> data = new ArrayList<String>(); BufferedReader br = null; String line = null;/* w ww . j ava2 s. c om*/ StringBuilder sb = new StringBuilder(); try { br = new BufferedReader(new FileReader(filename)); line = br.readLine(); if (line != null) { data.add(line); for (String retval : line.split(";")) { if (print) System.out.print(retval + " "); } } System.out.println(); while (line != null) { sb.append(line); sb.append(System.lineSeparator()); line = br.readLine(); if (line != null) { if (line.equals("") == false) data.add(line); for (String retval : line.split(";")) { if (print) System.out.print(retval + " "); } if (print) System.out.println(); } } // String everything = sb.toString(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { br.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return data; } }