Check out example codes for "fileinputstream read(byte[] b) example". It will help you in understanding the concepts better.

Code Example 1

package com.technicalkeeda;
import java.io.FileInputStream;
import java.io.IOException;
public class App {     
  public static void main(String[] args) {        
    try {  
      FileInputStream fileInputStream = new FileInputStream("C:\\technicalkeeda\\hello.txt");             
      byte[] bytes = new byte[16];           
      int i = fileInputStream.read(bytes);             
      System.out.println("Total bytes read :- " + i);             
      for (byte b: bytes) {                
        char c = (char) b;                
        System.out.print(c);            }             
      fileInputStream.close();  
    } 
    catch (IOException e) {           
      e.printStackTrace();       
    }   
  }
}

//  hello.txt contents is:
//  Hello TechnicalKeeda

//  output is: 
//  Total bytes read :- 16
// 
//  Hello TechnicalK

Learn ReactJs, React Native from akashmittal.com