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

org.iartisan.runtime.utils.UUIDUtil Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
package org.iartisan.runtime.utils;

import java.util.Date;
import java.util.UUID;

/**
 * 

* uuid util * * @author King * @since 2018/1/3 */ public class UUIDUtil { public static String timeBaseId(int length) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(DateUtils.formatDate(new Date(), DateUtils.YYYYMMDD)); UUID uuid = UUID.randomUUID(); stringBuilder.append(Math.abs(uuid.getMostSignificantBits())); stringBuilder.append(Math.abs(uuid.getLeastSignificantBits())); stringBuilder.setLength(length); return stringBuilder.toString(); } public static String shortId() { return timeBaseId(12); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy