### Question:
FileUtils { public static int countLines(File filename) throws IOException { try (InputStream is = new BufferedInputStream(new FileInputStream(filename));) { byte[] c = new byte[1024]; int count = 0; int readChars = 0; boolean empty = true; byte lastChar = '\n'; while ((readChars = is.read(c)) != -1) { for (int i = 0; i < readChars; ++i) { if (c[i] == '\n') { if (lastChar != '\n') { ++count; } } else { empty = false; } lastChar = c[i]; } } if (lastChar != '\n') { count++; } return (count == 0 && !empty) ? 1 : count; } }  static int countLines(File filename); static String readLineAt(int pos, File filename); static int getHashcodeFromFileContent(String filepath); static String readFile(String path);  }### Answer:
@Test public void countLinesTest() throws IOException { File f = new File("src/test/resources/fileUtils.txt"); assertEquals(6, FileUtils.countLines(f)); }