Here you can find the source of readInt(InputStream inputStream)
public static int readInt(InputStream inputStream) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { public static int readInt(InputStream inputStream) throws IOException { byte[] bytesToRead = new byte[4]; int readBytes = inputStream.read(bytesToRead); if (readBytes == -1) { return -1; }//from w ww . jav a 2s .c o m ByteBuffer buffer = ByteBuffer.wrap(bytesToRead); buffer.order(ByteOrder.LITTLE_ENDIAN); return buffer.getInt(); } }