public static short bytesToShort ( byte [ ] bytes , int offset ) { short result = 0x0 ; for ( int i = offset ; i < offset + 2 ; ++ i ) { result = ( short ) ( ( result ) << 8 ) ; result |= ( bytes [ i ] & 0x00FF ) ; } return result ; }
A utility method to convert the short from the byte array to a short .