Inside Solution, implement the journal over a temp directory you create in each call:
1. static Path append(Path file, String event) — appends event + "\n" in UTF-8
with CREATE + APPEND; returns the file.
2. static List<String> replay(Path file) — returns every complete line (a
TRUNCATED final line — one lacking its newline — must be dropped; use
Files.readString and split on "\n" carefully, or readAllLines and drop a final
fragment you detect by re-reading raw bytes).
3. static Path rotate(Path file, int maxLines) — if the file holds more than
maxLines complete lines, move it to a sibling named by appending ".1"
(file.1) atomically, and leave a fresh empty file at the original path; return
the ARCHIVE path (or the original if no rotation happened).
4. static int countEvents(Path file) — number of complete lines.
Difficulty: advanced