How to generate UUID / GUID?
GUID (Universally / Globally Unique IDentifier) are frequently use in programming. Some of its usage are for creating random file names, session id in web application, transaction id and for record's primary keys in database replacing the sequence or auto generated number.
UUID in Java we can use the
java.util.UUID class. This class was introduced in JDK 1.5
The result of our program is:
Random UUID String = 7dc53df5-703e-49b3-8670-b1c468f47f1f
UUID version = 4
UUID variant = 2