int moveTasksFromBuffers(Task[] tasks) {
        int maxTaskIndex = -1;
        for (int i = 0; i < buffers.length; i++) {
            int maxIndex = moveTasksFromBuffer(tasks, i);
            maxTaskIndex = Math.max(maxIndex, maxTaskIndex);
        }
        return maxTaskIndex;
    }
int moveTasksFromBuffers ( Task [ ] tasks ) { int maxTaskIndex = - 1 ; for ( int i = 0 ; i < buffers . length ; i ++ ) { int maxIndex = moveTasksFromBuffer ( tasks , i ) ; maxTaskIndex = Math . max ( maxIndex , maxTaskIndex ) ; } return maxTaskIndex ; }
Moves the tasks from the buffers into the output array.

@param tasks the ordered array of the pending operations
@return the highest index location of a task that was added to the array