public static void main(String[] args) {
        System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
        Map<Integer, TrackedFile> trackedFileMap = TorrentSimUtils.initializeTrackedFiles();
        Map<Integer, Peer> mapOfPeers = TorrentSimUtils.createPeerMap();
        TorrentSimUtils.distributeFilesAmongPeers(trackedFileMap, mapOfPeers);
        //displayFileSeeders(trackedFileMap);

        Tracker tracker = new Tracker();
        tracker.setAvailableFiles(trackedFileMap);

        for (Peer peer : mapOfPeers.values()) {
            peer.setTracker(tracker);
        }

        for (Peer peer : mapOfPeers.values()) {
            peer.getThread().start();
        }

        for (Peer peer : mapOfPeers.values()) {
            try {
                peer.getThread().join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }

        for (Peer peer : mapOfPeers.values()) {
            peer.showFinalState();
        }

        float totalSatisfaction =  TorrentSimUtils.calculateTotalSatisfaction(mapOfPeers);

        System.out.println("Total Satisfaction: " + totalSatisfaction);

        TorrentSimUtils.writeResultToFile(totalSatisfaction);
    }