All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hina.sdk.util.IdUtil Maven / Gradle / Ivy

The newest version!
package com.hina.sdk.util;

import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Random;
import java.util.UUID;

public class IdUtil {


    // 最新的生成id方法,使用UUID+随机数的方式
    public static String generateId(){
        UUID uuid = UUID.randomUUID();
        String s = uuid.toString();
        String m=s.replace("-","");
        Random random = new Random();
        int fourDigitNumber = 1000 + random.nextInt(9000);
        return m+fourDigitNumber;
    }




}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy