String fileName = "<file_name.txt>";
byte[] bytes = Files.readAllBytes(Path.of(fileName));
import java.nio.file.*;
public class ReadBinaryFile {
public static void main(String[] args) {
String fileName = "<file_name.txt>";
try {
byte[] bytes = Files.readAllBytes(Path.of(fileName));
System.out.print(bytes);
} catch (Exception e) {
System.out.println("Error while reading byte file");
System.out.println(e.toString());
}
}
}
Content from bytefile