code: void updateDrainedOrder(Task[] tasks, int maxTaskIndex) {
          if (maxTaskIndex >= 0) {
              Task task = tasks[maxTaskIndex];
              drainedOrder = task.getOrder() + 1;
          }
      }
docs: Updates the order to start the next drain from.
  
  @param tasks        the ordered array of operations
  @param maxTaskIndex the maximum index of the array