QualityConverter { public static short toShort(final byte[] value) { final byte[] ba = reverseAllBitsAndBytes(value); final ByteBuffer bb = ByteBuffer.wrap(ba); final short s = bb.getShort(); LOGGER.debug("Converting byte array [{}], reversed [{}] into short [{}]", toString(value), toString(ba), s); return s; } private  QualityConverter(); static short toShort(final byte[] value); static byte[] fromShort(final short value);  }
@Test public void testToShort() throws Exception { final byte[] ba = new byte[2]; ba[0] = (byte) 193; ba[1] = (byte) 0; final short s = QualityConverter.toShort(ba); assertThat(s).isEqualTo((short) 131); }