How to Generate an unique ID in Java
Published: September 7, 2009 , Updated: January 21, 2010 , Author: mkyong
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







Its Good, simple way to get UUID
Its nice. Could have explored the options supported in UUID and the limitations identified to explore more.