For this activity we using library FileInputStream

here simple example for this


FileInputStream fileInputStream=null;

File myFile = new File("C:\\myFile.txt");

byte[] byteFile = new byte[(int) myFile.length()];

try {
fileInputStream = new FileInputStream(myFile);
fileInputStream.read(byteFile);
fileInputStream.close();

for (int i = 0; i < byteFile.length; i++) { System.out.print((char)byteFile[i]); } }catch(Exception ex){ ex.printStackTrace(); }