Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- class ReadBytesFromFile {
- public static void main(String args[]) throws Exception {
- File file;
- FileInputStream fileStream = new FileInputStream(file = new File("test.txt"));
- byte[] arr = new byte[(int) file.length()];
- //чтение
- fileStream.read(arr, 0, arr.length);
- //вывод
- for (int X : arr) {
- System.out.print((char) X);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement