![java 生成GUID与UUID java 生成GUID与UUID](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
java 生成GUID与UUID
CreateTime--2018年5月31日16点29分
Author:Marydon
import java.util.UUID;
public static void main(String args[]){
// 生成UUID
String uuid = UUID.randomUUID().toString();
System.out.println(uuid);// 比如:cff84d96-7c1f-4c7d-abe2-67b075b42e12
// 生成GUID(32位)
String guid = UUID.randomUUID().toString().replace("-", "").toUpperCase();
System.out.println(guid);// 比如:121AFA7791DF480DA1A7B5E3285FF2EF
}