### Question:
FileUtils { public static String readFirstLines(File file, int lineCount, String encoding) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding)); try { String line; StringBuilder sb = new StringBuilder(); while (lineCount > 0 && (line = reader.readLine()) != null) { lineCount--; sb.append(line).append("\n"); } return sb.toString(); } finally { reader.close(); } } private  FileUtils(); static void write(File file, String content, String encoding); static String read(URL location, String encoding, Map<String, String> properties); static String read(URL location, String encoding); static String[] read(final URL[] locations, final String encoding); static String read(File file, String encoding); static String readFirstLines(File file, int lineCount, String encoding); static String remove(String str, String... chars); static void copyFileToFolder(File file, File folder); static Path asPath(final File file);  }### Answer:
@Test public void test_read_first_lines() throws Exception { String s = FileUtils.readFirstLines(new File("src/test/data/compileCP/test2.txt"), 3, "ISO-8859-1"); assertTrue(s.contains("c")); assertFalse(s.contains("d")); }