### Question:
ArrayParameters { static int computeNewIndex(int index, List<ArrayParameter> arrayParametersSortedAsc) { int newIndex = index; for(ArrayParameter arrayParameter : arrayParametersSortedAsc) { if(index > arrayParameter.parameterIndex) { newIndex = newIndex + arrayParameter.parameterCount - 1; } else { return newIndex; } } return newIndex; }    }### Answer:
@Test public void testComputeNewIndex() { assertEquals( 2, ArrayParameters.computeNewIndex( 2, ImmutableList.of( new ArrayParameters.ArrayParameter(3, 5) ) ) ); assertEquals( 3, ArrayParameters.computeNewIndex( 3, ImmutableList.of( new ArrayParameters.ArrayParameter(3, 5) ) ) ); assertEquals( 8, ArrayParameters.computeNewIndex( 4, ImmutableList.of( new ArrayParameters.ArrayParameter(3, 5) ) ) ); assertEquals( 9, ArrayParameters.computeNewIndex( 4, ImmutableList.of( new ArrayParameters.ArrayParameter(1, 2), new ArrayParameters.ArrayParameter(3, 5) ) ) ); assertEquals( 9, ArrayParameters.computeNewIndex( 4, ImmutableList.of( new ArrayParameters.ArrayParameter(1, 2), new ArrayParameters.ArrayParameter(3, 5), new ArrayParameters.ArrayParameter(4, 5) ) ) ); assertEquals( 9, ArrayParameters.computeNewIndex( 4, ImmutableList.of( new ArrayParameters.ArrayParameter(1, 2), new ArrayParameters.ArrayParameter(3, 5), new ArrayParameters.ArrayParameter(5, 5) ) ) ); }