uuid - How to create Unique Id in Java -
i have code below:
d00077b4-ebfb-4bd8-9e3f-1f3943cbce35
i wondering how generate code in java.
this uuid, "a 128-bit number used identify information in computer systems".
the format explained as:
in canonical textual representation, sixteen octets of uuid represented 32 hexadecimal (base 16) digits, displayed in 5 groups separated hyphens, in form 8-4-4-4-12 total of 36 characters (32 alphanumeric characters , 4 hyphens). example:
123e4567-e89b-12d3-a456-426655440000 xxxxxxxx-xxxx-mxxx-nxxx-xxxxxxxxxxxx
how generate code using java?
// create random uuid: uuid uuid1 = uuid.randomuuid(); system.out.println(uuid1); // create fixed uuid: string uuidstring = "d00077b4-ebfb-4bd8-9e3f-1f3943cbce35"; uuid uuid2 = uuid.fromstring(uuidstring); system.out.println(uuid2); // string uuid: uuid uuid = ... string s = uuid.tostring(); system.out.println(s);
Comments
Post a Comment