ArrayConverters { public static int[] convertTwoByteToIntegers(byte[] byteArray) { ByteBuffer bb = ByteBuffer.wrap(byteArray); int outLength = byteArray.length/2; int[] outArray = new int[outLength]; for (int i=0; i<outLength; i++) { outArray[i] = bb.getShort(); } return outArray; }  static String[] decodeChainList(byte[] currentChainList, int length); static float[] convertIntsToFloats(int[] intArray, float floatDivider); static int[] convertByteToIntegers(byte[] byteArray); static int[] convertTwoByteToIntegers(byte[] byteArray); static short[] convertTwoBytesToShorts(byte[] byteArray); static int[] convertFourByteToIntegers(byte[] byteArray); static int[] combineIntegers(int[] twoByteIntArray, int[] fourByteIntArray); static char[] convertIntegerToChar(int[] integerArray); static byte[] convertIntegersToBytes(int[] intArray); static byte[] convertIntegersToTwoBytes(int[] intArray); static byte[] convertShortsToTwoBytes(short[] shortArray); static byte[] convertIntegersToFourByte(int[] intArray); static int[] convertFloatsToInts(float[] floatArray, float floatMultiplier); static List<int[]> splitIntegers(int[] inputArray); static int[] convertCharToIntegers(char[] charArray); static byte[] encodeChainList(String[] chainNames, int length); static int[] recursiveIndexEncode(int[] in); static int[] recursiveIndexDecode(int[] in);  }
@Test public final void twoByteToIntegersTest(){ int[] testIntArray = {1000,1002,546}; byte[] byteArray = getByteArray(testIntArray,2); int[] intArray = ArrayConverters.convertTwoByteToIntegers(byteArray); assertArrayEquals(testIntArray, intArray); }