Java UUID Create generateUUID()

Here you can find the source of generateUUID()

Description

generate UUID

License

Open Source License

Declaration

public static String generateUUID() 

Method Source Code


//package com.java2s;

import java.util.UUID;

public class Main {

    public static String generateUUID() {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 8; i++) {
            sb.append(UUID.randomUUID().toString().split("-")[0]);
            sb.append(UUID.randomUUID().toString().split("-")[1]);
            sb.append(UUID.randomUUID().toString().split("-")[2]);
            sb.append(UUID.randomUUID().toString().split("-")[3]);
            sb.append(UUID.randomUUID().toString().split("-")[4]);
        }/*from www . j  av  a2 s .c om*/
        return sb.toString();
    }
}

Related

  1. generateUUID()
  2. generateUuid()
  3. generateUUID()
  4. generateUUID()
  5. generateUUID()
  6. generateUUID()
  7. generateUUID()
  8. generateUuid(boolean dash)
  9. generateUUID(int numchars)