### Question:
Bytes { public static short[] toShortArray(byte[] ba, int amount, boolean bigEndian) { final int size = determineSize(amount, ba.length, 2); short[] result = new short[size / 2]; int i = 0; for (int j = 0; j < size; j += 2) { if (bigEndian) { result[i++] = (short) (ba[j] << 8 & 0xff00 | ba[j + 1] & 0xff); } else { result[i++] = (short) (ba[j + 1] << 8 & 0xff00 | ba[j] & 0xff); } } return result; }  static byte[] toByteArray(int... uints); static int toInt(byte[] pb, boolean bigEndian); static int normalize(int i, int bitCount); static void normalize(int iarr[], int bitCount); static byte[] toByteArray(int i, int size, boolean isBigEndian); static int toInt(byte b0, byte b1, byte b2, byte b3, boolean bigEndian); static byte[] toByteArray(int i, boolean bigEndian); static byte[] toByteArray(short i, boolean bigEndian); static int[] toIntArray(byte[] ba, int amount, boolean bigEndian); static int[] toIntArray(byte[] ba, final int amount, final int bytePerInteger,
      boolean bigEndian); static int[] toReducedBitIntArray(
      byte[] ba,
      final int amount,
      int bytePerInteger,
      int bitAmount,
      boolean bigEndian); static short[] toShortArray(byte[] ba, int amount, boolean bigEndian); static byte[] toByteArray(short[] sa, int amount, boolean bigEndian); static byte[] toByteArray(int[] ia, int amount, int bytePerInteger, boolean bigEndian); static String toHexWithZeros(byte b); static String toHex(byte b); static String toHex(byte[] bytes); static String toHexWithZeros(byte[] bytes); static void hexDump(OutputStream os, byte[] bytes, int columns); static void hexDump(byte[] bytes, int columns); static final byte[] EMPTY_BYTE_ARRAY; }### Answer:
@Test public void testToShort() { byte[] barr = {0x7e, (byte) 0xac, (byte) 0x8a, (byte) 0x93}; short[] sarrBe = {0x7eac, (short) 0x8a93}; short[] sarrLe = {(short) 0xac7e, (short) 0x938a}; Assert.assertArrayEquals(Bytes.toShortArray(barr, barr.length, true), sarrBe); Assert.assertArrayEquals(Bytes.toShortArray(barr, barr.length, false), sarrLe); }