Java generates UUID, java generates uuid

Source: Internet
Author: User

Java generates UUID, java generates uuid

UUID (Universally Unique Identifier) is a globally Unique Identifier. It is a 128-bit long number and generally expressed in hexadecimal notation.

The core idea of the algorithm is to generate a UUID Based on the machine's Nic, local time, and a random number. UUID is a new class in 1.5.

In java. util, you can use it to generate a globally unique ID. The unique defect of UUID is that the generated result string is long.

Public class Test {/*** @ param args * @ throws Exception */public static void main (String [] args) throws Exception {UUID uuid = UUID. randomUUID (); // uuid generation System. out. println (uuid); // output generated }}

 


How to generate UUID like Java in C #

UUID does not know, but it is similar to using GUID.
Private void button1_Click_1 (object sender, System. EventArgs e)
{
Guid guid = Guid. NewGuid ();
MessageBox. Show (guid. ToString ());
}

[Java] Can I generate a unique UUID using the following method?

Of course you can. No problem!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.