/**
* @description: 邀请码
* @create: 2020-06-03 15:52
**/
package com.pdw.util;
import java.util.Random;
public class CodeUtils {
private static final long OFFSET = 1577808000000L;
private static final char[] r = new char[]{
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
/** 定义一个字符用来补全邀请码长度(该字符前面是计算出来的邀请码,后面是用来补全用的) */
private static final char b='0';
/** 进制长度 */
private static final int binLen = r.length;
/** 邀请码长度 */
private static final int s = 8;
/**
* 根据ID生成随机码
* @param id ID
* @return 随机码
*/
public static String toSerialCode(long id) {
char[
java生成八位不重复的数字的工具类
最新推荐文章于 2024-07-22 14:15:06 发布