code: private String[] readFile(String fileName) throws IOException {
      ArrayList<String> result = new ArrayList<String>();
      FileReader fReader = new FileReader(fileName);
      BufferedReader bReader = new BufferedReader(fReader);
      while (true) {
        String line = bReader.readLine();
        if (line == null) {
          break;
        }
        result.add(line);
      }
      bReader.close();
      fReader.close();
      return (String[])result.toArray(new String[result.size()]);
    }
docs: Read a file line by line
  @param fileName
  @return String[] contains lines
  @throws IOException