bson/src/main/org/bson/io/Bits.java
public static int readInt(final byte[] buffer, final int offset) {
        int x = 0;
        x |= (0xFF & buffer[offset + 0]) << 0;
        x |= (0xFF & buffer[offset + 1]) << 8;
        x |= (0xFF & buffer[offset + 2]) << 16;
        x |= (0xFF & buffer[offset + 3]) << 24;
        return x;
    }
public static int readInt(final byte[] buffer, final int offset) {
        int x = 0;
        x |= (0xFF & buffer[offset + 0]) << 0;
        x |= (0xFF & buffer[offset + 1]) << 8;
        x |= (0xFF & buffer[offset + 2]) << 16;
        x |= (0xFF & buffer[offset + 3]) << 24;
        return x;
    }
public static int readInt ( final byte [ ] buffer , final int offset ) { int x = 0 ; x |= ( 0xFF & buffer [ offset + 0 ] ) << 0 ; x |= ( 0xFF & buffer [ offset + 1 ] ) << 8 ; x |= ( 0xFF & buffer [ offset + 2 ] ) << 16 ; x |= ( 0xFF & buffer [ offset + 3 ] ) << 24 ; return x ; }
Reads and returns a single integer value from the buffer.

@param buffer the buffer to read from
@param offset the position to start reading from the buffer
@return the integer value
Reads and returns a single integer value from the buffer .