Searching...
Friday, 4 October 2013

How to generate UUID in java ?

11:44

java.util.UUID class represents an immutable universally unique identifier (UUID). Below example generates a 128 bit value using UUID.

package com.pretechsol;
import java.util.UUID;
public class UUIDExample {
	public static void main(String[] args) {
			System.out.println(UUID.randomUUID());
		}
}

Output



4a6bfc5d-8ce0-41a0-830c-e6db704fe58a


0 comments: