@Test
public void testToByteShort() {

    byte[] baShort = {0x43, (byte) 0xac};
    byte[] baShortReverse = {(byte) 0xac, 0x43};
    short bigEndianShort = 0x43ac;
    short littleEndianShort = (short) 0xac43;
    Assert.assertArrayEquals(Bytes.toByteArray(bigEndianShort, true), baShort);
    Assert.assertArrayEquals(Bytes.toByteArray(bigEndianShort, false), baShortReverse);
    Assert.assertArrayEquals(Bytes.toByteArray(littleEndianShort, false), baShort);
    Assert.assertArrayEquals(Bytes.toByteArray(littleEndianShort, true), baShortReverse);
}