### Question:
Utils { public static <T> void shiftIntegerMapKeys(int startKey, int shift, TIntObjectMap<T> intToObject) { if (shift == 0) { return; } TIntList keysToShift = new TIntArrayList(intToObject.keys()); for (int currentKey : keysToShift.toArray()) { if (currentKey <= startKey) { keysToShift.remove(currentKey); } } keysToShift.sort(); if (shift > 0) { keysToShift.reverse(); } for (int currentKey : keysToShift.toArray()) { T obj = intToObject.get(currentKey); intToObject.remove(currentKey); intToObject.put(currentKey + shift, obj); } }  static Object buildArray(String internalName, int length); static Object buildArray(String internalName, int length, ClassLoader classLoader); static List<String> builderTypeListToTypeNames(BuilderTypeList typeList); static String buildFieldDescriptor(Field field); static Object castToPrimitive(Object value, String targetType); static String getArrayDimensionString(Object array); static Double getDoubleValue(Object obj); static List<File> getFilesWithSmaliExtension(File file); static Float getFloatValue(Object obj); static Integer getIntegerValue(Object obj); static MethodLocation[] getLocations(BuilderInstruction... instructions); static Long getLongValue(Object obj); static MethodLocation getNextLocation(MethodLocation location, TIntObjectMap<MethodLocation> addressToLocation); static List<String> getParameterTypes(String methodDescriptor); static int getRegisterSize(BuilderTypeList typeList); static int getRegisterSize(Class<?>[] parameterTypes); static int getRegisterSize(List<String> typeNames); static int getRegisterSize(String typeName); static Set<String> getDeclaredAndValueTypeNames(HeapItem item); static void shiftIntegerMapKeys(int startKey, int shift, TIntObjectMap<T> intToObject);  }### Answer:
@Test public void shiftIntegerMapKeysShiftsUpAsExpected() { TIntObjectMap<String> intToObject = new TIntObjectHashMap<String>(); intToObject.put(1, "one"); intToObject.put(2, "two"); intToObject.put(3, "three"); Utils.shiftIntegerMapKeys(1, 2, intToObject); assertEquals(3, intToObject.size()); assertEquals("one", intToObject.get(1)); assertEquals("two", intToObject.get(4)); assertEquals("three", intToObject.get(5)); }
@Test public void shiftIntegerMapKeysRemovesWhenShiftingDown() { TIntObjectMap<String> intToObject = new TIntObjectHashMap<String>(); intToObject.put(1, "one"); intToObject.put(2, "two"); intToObject.put(3, "three"); Utils.shiftIntegerMapKeys(1, -1, intToObject); assertEquals(2, intToObject.size()); assertEquals("two", intToObject.get(1)); assertEquals("three", intToObject.get(2)); }