code: public static int readInt(byte b[], int offset) {
      int retValue;
  
      retValue = ((int)b[offset++]) << 24;
      retValue |= ((int)b[offset++] & 0xff) << 16;
      retValue |= ((int)b[offset++] & 0xff) << 8;
      retValue |= (int)b[offset] & 0xff;
  
      return retValue;
    }
docs: Unserializes an int from a byte array at a specific offset in big-endian order
  
  @param b byte array from which to read an int value.
  @param offset offset within byte array to start reading.
  @return int read from byte array.