private static void writeTo(String outputFileName, ArrayList<String> lines)
            throws IOException {
        PrintWriter writer;

        if (outputFileName == null) {
            throw new IOException("No file has been loaded.");
        }
        writer = new PrintWriter(new FileOutputStream(outputFileName));
        for (String line : lines) {
            writer.println(line);
        }
        writer.close();
    }