Using java.util.UUID
import java.util.UUID; public class Main { public static void main(String arg[]) { System.out.println(UUID.randomUUID()); } } //138a4222-e898-484f-8347-dafc01c5b03b