Reposting with code my code from IntelliJ. This meets every condition.