

The use of UUID depends on the situation, use cases, complexity, and conditions. It is also known as a Globally Unique IDentifier (GUID). A UUID is 36 characters (128-bit) long unique number. It is a part of the Distributive Computing Environment (DCE). UUIDs are standardized by the Open Software Foundation (OSF). UUID stands for Universally Unique IDentifier. In this section, we will discuss what is UUID and how to randomly generate UUID (version 4) in Java. It consists of hex-digits separated by four hyphens. * * 1.5 */ public final class UUID implements java.io.UUID is a widely used 128-bit long unique identification number in the computer system. * * For more information including algorithms used to create UUID}s, * see RFC 4122: A * Universally Unique IDentifier (UUID) URN Namespace, section 4.2 * 'Algorithms for Creating a Time-Based UUID'. These types have a * version value of 1, 2, 3 and 4, respectively. There are four different basic types of UUIDs: time-based, DCE * security, name-based, and randomly generated UUIDs.

* * The version field holds a value that describes the type of this * UUID}. The bit layout described above is valid only for a * UUID} with a variant value of 2, which indicates the Leach-Salz variant. * * The layout of a variant 2 (Leach-Salz) UUID is as follows: * * The most significant long consists of the following unsigned fields: * * 0xFFFFFFFF00000000 time_low * 0x00000000FFFF0000 time_mid * 0x000000000000F000 version * 0x0000000000000FFF time_hi * * The least significant long consists of the following unsigned fields: * * 0xC000000000000000 variant * 0x3FFF000000000000 clock_seq * 0x0000FFFFFFFFFFFF node * * * The variant field contains a value which identifies the layout of the * UUID}.

The methods * of this class are for manipulating the Leach-Salz variant, although the * constructors allow the creation of any variant of UUID (described below). * * There exist different variants of these global identifiers. */ package java.util import curity.* /** * A class that represents an immutable universally unique identifier (UUID). * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit if you need additional information or have any * questions. * * You should have received a copy of the GNU General Public License version * 2 along with this work if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE.

Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is free software you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. Line source /* * Copyright (c) 2003, 2013, Oracle and/or its affiliates.
