private long read32 ( byte [ ] buffer , int offset ) { byte b0 = buffer [ offset ] ; byte b1 = buffer [ offset + 1 ] ; byte b2 = buffer [ offset + 2 ] ; byte b3 = buffer [ offset + 3 ] ; // convert signed bytes to unsigned values int i0 = ( ( b0 & 0x80 ) == 0x80 ? ( b0 & 0x7F ) + 0x80 : b0 ) ; int i1 = ( ( b1 & 0x80 ) == 0x80 ? ( b1 & 0x7F ) + 0x80 : b1 ) ; int i2 = ( ( b2 & 0x80 ) == 0x80 ? ( b2 & 0x7F ) + 0x80 : b2 ) ; int i3 = ( ( b3 & 0x80 ) == 0x80 ? ( b3 & 0x7F ) + 0x80 : b3 ) ; return ( ( long ) i0 << 24 ) + ( ( long ) i1 << 16 ) + ( ( long ) i2 << 8 ) + ( long ) i3 ; }
Reads an unsigned 32 bit big endian number from the given offset in the buffer .