I want to finish the make the best method with clarity and efficiency, can you polish and fill in for the auditFromHistory method?


“””
private void auditFromHistory(Scanner scanner) {
    try {
        // assign log file path with the default if null
        if (logFilePath == null) {
            logFilePath = "rescuebot.log";
        }

        // create new file if it not existed yet
        File file = new File(logFilePath);

        // if no logfile is found or having an empty file
        if (!file.exists() || file.length() == 0) {
            throw new FileNotFoundException("No history found.");
        }

        // create separate stats to store and parse scenarios
        Statistic algorithmStats = new Statistic();
        Statistic userStats = new Statistic();


    } catch (FileNotFoundException e) {
        System.out.println(e.getMessage() + " Press enter to return to main menu.");
        System.out.print("> ");
        scanner.nextLine(); // wait for Enter key as the input
    }
}
“””  the save function saveScenario would generate sample log file as demonstrated below  “”” // save and append the each scenario and each user decision
private void saveScenario(Scenario scenario, Location rescuedLocation, boolean isUserDecision) {
    try {
        // assign log file path with the default if null
        if (logFilePath == null) {
            logFilePath = "rescuebot.log";
        }

        // create new file if it not existed yet
        File file = new File(logFilePath);
        if (!file.exists()) {
            file.createNewFile();
        }

        // use FileWriter and set the flag to be true that gives the append mode
        FileWriter fileWriter = new FileWriter(file, true);

        // denotes who wrote the decision
        NAME_1 decisionBy = isUserDecision ? "User" : "Algorithm";
        fileWriter.write("Decision: " + decisionBy + "\n");

        // write scenario
        fileWriter.write("# Scenario: " + scenario.getDescriptor() + "\n");

        // write locations
        for (Location location : scenario.getLocations()) {
            fileWriter.write("Location: " + location.getLatitude() + ", " + location.getLongitude() + "\n");
            fileWriter.write("Trespassing: " + location.getLegality() + "\n");
            // gfet characters info and write them
            fileWriter.write(location.getCharacters().size() + " Characters:\n");
            for (NAME_2 NAME_2 : location.getCharacters()) {
                fileWriter.write("- " + NAME_2.getClass().getSimpleName().toLowe Do not include the following keywords: file, flag, log, decisionby
user