1package com.technicalkeeda;
2import java.io.FileInputStream;
3import java.io.IOException;
4public class App {
5 public static void main(String[] args) {
6 try {
7 FileInputStream fileInputStream = new FileInputStream("C:\\technicalkeeda\\hello.txt");
8 byte[] bytes = new byte[16];
9 int i = fileInputStream.read(bytes);
10 System.out.println("Total bytes read :- " + i);
11 for (byte b: bytes) {
12 char c = (char) b;
13 System.out.print(c); }
14 fileInputStream.close();
15 }
16 catch (IOException e) {
17 e.printStackTrace();
18 }
19 }
20}
21
22// hello.txt contents is:
23// Hello TechnicalKeeda
24
25// output is:
26// Total bytes read :- 16
27//
28// Hello TechnicalK