question: private int [ ] calculateTaskCountPerContainer ( int taskCount , int prevContainerCount , int currentContainerCount ) { int [ ] newTaskCountPerContainer = new int [ Math . max ( currentContainerCount , prevContainerCount ) ] ; Arrays . fill ( newTaskCountPerContainer , 0 ) ; for ( int i = 0 ; i < currentContainerCount ; i ++ ) { newTaskCountPerContainer [ i ] = taskCount / currentContainerCount ; if ( taskCount % currentContainerCount > i ) { newTaskCountPerContainer [ i ] ++ ; } } return newTaskCountPerContainer ; }
target:  Calculates the expected number of tasks for each container. The count is generated for max(oldContainerCount, newContainerCount) s.t. if the container count has decreased, the excess containers will have a count == 0, indicating that any tasks assigned to them should be reassigned.