ID generator example written in pure Java