How to generate unique ID that is integer in java that not guess next number?
int uniqueId = 0; int getUniqueId() { return uniqueId++; }
Add synchronized if you want it to be thread safe.
synchronized