Here you can find the source of uuidFromString(String s)
public static UUID uuidFromString(String s)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static UUID uuidFromString(String s) { if (s.contains("-")) { return UUID.fromString(s); } else {//from w w w . j a v a 2 s. c om return UUID .fromString(s .replaceFirst( "([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)", "$1-$2-$3-$4-$5")); } } }