Read short type of data with DataInputStream
import java.io.DataInputStream; import java.io.FileInputStream; class Main { public static void main(String args[]) throws Exception { FileInputStream fis = new FileInputStream(args[0]); DataInputStream dis = new DataInputStream(fis); // Read and display data System.out.print(dis.readShort() + " "); fis.close(); } }