public static short decodeShort ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { return ( short ) ( ( ( src [ srcOffset ] << 8 ) | ( src [ srcOffset + 1 ] & 0xff ) ) ^ 0x8000 ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingException ( null , e ) ; } }
Decodes a signed short from exactly 2 bytes .