protected short grabShort ( byte [ ] bytes , int offset ) { int ndx0 = offset + ( littleEndianData ? 1 : 0 ) ; int ndx1 = offset + ( littleEndianData ? 0 : 1 ) ; // careful that we only allow sign extension on the highest order byte return ( short ) ( bytes [ ndx0 ] << 8 | ( bytes [ ndx1 ] & 0xff ) ) ; }
Unpack a two - byte integer from the given byte array .