public static short readShort ( byte [ ] array , int offset ) { // First make integers to resolve signed vs. unsigned issues. int b0 = array [ offset + 0 ] & 0xFF ; int b1 = array [ offset + 1 ] & 0xFF ; return ( short ) ( ( b0 << 8 ) + ( b1 << 0 ) ) ; }
Read a short from the byte array at the given offset .