ArrayConverters { public static List<int[]> splitIntegers(int[] inputArray) { List<Integer> fourByteInts = new ArrayList<>(); List<Integer> twoByteInts = new ArrayList<>(); fourByteInts.add(inputArray[0]); int counter =0; for(int i=1;i<inputArray.length;i++){ if(inputArray[i]>Short.MAX_VALUE || inputArray[i] < Short.MIN_VALUE){ fourByteInts.add(counter); fourByteInts.add(inputArray[i]); counter = 0; } else{ twoByteInts.add(inputArray[i]); counter++; } } fourByteInts.add(counter); List<int[]> outputList = new ArrayList<>(); outputList.add(CodecUtils.convertToIntArray(fourByteInts)); outputList.add(CodecUtils.convertToIntArray(twoByteInts)); return outputList; }  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 void splitArraysTest() { int[] testTwoByteIntArray = {1,2,5,4,50,0}; int[] testFourByteIntArray = {10002,4,1303040,2}; int[] combinedArray = {10002,1,2,5,4,1303040,50,0}; List<int[]> outVal = ArrayConverters.splitIntegers(combinedArray); assertArrayEquals(testFourByteIntArray, outVal.get(0)); assertArrayEquals(testTwoByteIntArray, outVal.get(1)); }