Java tutorial
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { public static int byteArrayToIntLE(byte[] bytes) throws IllegalArgumentException { if (bytes.length != (Integer.SIZE / Byte.SIZE)) { throw new IllegalArgumentException("Incorrect array size to convert to an int"); } ByteBuffer buffer = ByteBuffer.wrap(bytes); buffer.order(ByteOrder.LITTLE_ENDIAN); return buffer.getInt(); } }