String uuid = UUID.randomUUID().toString().trim().replaceAll("-", ""); 这是去掉 '-' 分隔符的,若不想去除则不用替换。 import java.util.UUID;