Java tutorial
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { public static int readInt(byte[] message, int start) { /* Read in the type */ ByteBuffer typeBuffer = ByteBuffer.allocate(4).order(ByteOrder.BIG_ENDIAN); typeBuffer.put(message, start, 4).position(0); return typeBuffer.getInt(); } }