Based on @erickson`s answer, you can use:
public String readAll(String fileName) throws IOException { List<String> lines = Files.readAllLines(new File(fileName).toPath()); return String.join("\n", lines.toArray(new String[lines.size()]));}
Based on @erickson`s answer, you can use:
public String readAll(String fileName) throws IOException { List<String> lines = Files.readAllLines(new File(fileName).toPath()); return String.join("\n", lines.toArray(new String[lines.size()]));}