Read all file content to a byte array
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Test { public static void main(String[] args) throws IOException { Path path = Paths.get("/users.txt"); byte[] contents = Files.readAllBytes(path); for (byte b : contents) { System.out.print((char) b); } } }