java 中如何将string转换成uuid

public static void main(String[] arg0) {
   
String uuid="0c312388-5d09-4f44-b670-5461605f0b1e";
UUID uuid1=UUID.randomUUID();
UUID uuid2=UUID.fromString(uuid);
System.out.println(uuid1);
System.out.println(uuid2);
}

你可能感兴趣的:(Struts2的优化,java)