Java tutorial
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.util.UUID; public class Main { public static final String UUID_BASE = "0000XXXX-0000-1000-8000-00805f9b34fb"; public static UUID uuidFromString(String uuid) { if (uuid.length() == 4) { uuid = UUID_BASE.replace("XXXX", uuid); } return UUID.fromString(uuid); } }