Java tutorial
//package com.java2s; 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]; inputStream.read(bytesToRead); ByteBuffer buffer = ByteBuffer.wrap(bytesToRead); buffer.order(ByteOrder.LITTLE_ENDIAN); return buffer.getInt(); } }