Here you can find the source of generateUUID()
public static String generateUUID()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; import java.util.Random; public class Main { public static String generateUUID() { // SimpleDateFormat is not thread-safe, so we simply create a new one // everytime. return createSimpleDateFormat().format(new Date()) + "-" + new Random().nextInt(10000); }/*from w w w . j a v a 2s .c om*/ public static SimpleDateFormat createSimpleDateFormat() { return new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss-S"); } }