public static int get24BitIntFromBytes ( byte [ ] buf , int offset ) { int i = 0 ; offset ++ ; i += buf [ offset ++ ] & 0xFF ; i += ( ( buf [ offset ++ ] & 0xFF ) << 8 ) ; i += ( ( buf [ offset ] & 0xFF ) << 16 ) ; return i ; }
Extracts an int from an array of bytes . Only three bytes are pulled together from the array to make a 24 bit integer albeit returned as a java 32 bit int .