Example
UUID is the fastest and easiest way to generate unique ID in Java.
import java.util.UUID;
public class UniqueIDTest {
public static void main(String[] args) {
UUID uniqueKey = UUID.randomUUID();
System.out.println (uniqueKey);
}
}
Result
0a6a3de7-b974-42d0-af9e-9c23473b09b9
good tutorials
Is there any way to get a unique id that will be the same every time for a particular machine regardless of OS?
Hi, what if we want to generate unique ID with fixed length then how the code looks like.
is this version 1 or version 4 uuid..??
Thank you. in the bull’s eye
Nice piece of code but not every time it is unique….
its good,thanks
I am trying to generate a unique 10 digit alpha numeric number, any way to do that in a distributed system
Its Good, simple way to get UUID
Its nice. Could have explored the options supported in UUID and the limitations identified to explore more.