Java唯一码生成

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

private static String beforeBh;
private static String beforeNum;

public static String codeGenerate() {
  Date now = new Date();
  String behind = now.getTime()+"";
  if(beforeBh==null) {
   beforeBh = behind;
  } else if(beforeBh.equals(behind)) {
   behind = behind +beforeNum;
   beforeNum++;
  } else {
   beforeBh = behind;
   beforeNum = 0;
  }
  return behind;