Java tutorial
//package com.java2s; public class Main { public static int byteArrayToUint32(byte[] src, int offset) throws IllegalArgumentException { int mask = 0xff; int temp = 0; int dest = 0; if (src.length < 4 + offset) { throw new IllegalArgumentException( "Failed to translate " + src.length + " bytes to uint32 with " + offset + " offset"); } for (int i = 0; i < 4; i++) { dest <<= 8; temp = src[offset + 3 - i] & mask; dest |= temp; } return dest; } }