public int calcFreeSeats(HashMap<Integer, Integer[]> passengerByStation, List<Object[]> allStationsByTrain, Station stationFrom, Station stationTo, Train train) {
        log.debug("Start method \"calcFreeSeats\"");
        int occupiedSeats = 0;
        int maxOccupied = -1;
        boolean calcMax = false;
        for (Object[] obj : allStationsByTrain) {
            Integer stationId = (Integer) obj[0];
            String stationName = (String) obj[1];
            if (stationTo.getName().equals(stationName)) {
                break;
            }
            if (passengerByStation.containsKey(stationId)) {
                Integer[] change = passengerByStation.get(stationId);
                occupiedSeats += change[0] - change[1];
            }
            if (stationFrom.getName().equals(stationName)) {
                calcMax = true;
            }
            if (calcMax && maxOccupied < occupiedSeats) {
                maxOccupied = occupiedSeats;
            }
        }
        return train.getTotalSeats() - maxOccupied;
    }