Supertux Supertux - 1 year ago 171
Java Question

How do I create a unique ID in Java?

I'm looking for the best way to create a unique ID as a String in Java.

Any guidance appreciated, thanks.

I should mention I'm using Java 5.

Answer Source

Create a UUID.

String uniqueID = UUID.randomUUID().toString();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download