您的位置:首页 > 产品设计 > UI/UE

java随机生成16位UUID

2017-06-20 23:58 3695 查看
随机生成实现代码:

public String getuuid(){
UUID uuid=UUID.randomUUID();
String str = uuid.toString();
String uuidStr=str.replace("-", "");
return uuidStr;
}


根据给定字符串生成实现代码:

public String getuuid(String str){
UUID uuid=UUID.nameUUIDFromBytes(name.getBytes());
String str = uuid.toString();
String uuidStr=str.replace("-", "");
return uuidStr;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: