Java generates a guid. Using the import class java. util. UUID, the generated GUID is a 32-Bit String of 128-bit data, which can be globally unique.
It is quite easy to generate guids. The following is a demonstration of generating five guids at a time.
// Import class
Import java. util. UUID;
// Create a primary class
Public class guid
{
// Main Function
Public static void main (string [] ARGs)
{
// Generate 5 guids
For (INT I = 0; I <5; I ++)
{
// Create a guid object
UUID = UUID. randomuuid ();
// Obtain the ID generated by the object
String A = UUID. tostring ();
// Convert to uppercase
A = A. touppercase ();
// Replace-
// A = A. replaceall ("-","");
System. Out. println ();
}
}
}
Output result
20175c27c-a444-4d65-8ffb-b04108321b35
C4264865-385E-4C5B-B78D-3700714E8379
B09EEBBE-1915-497E-850E-015740DA45CF
6ea70626-5006-4db9-84f9-a860a6042a36
3e62b608-0e40-4b80-81b8-e40c3b11958d