/** * 生成19位long型唯一数字id * @return */ public static long GetLong19UUID() { // String nanoRandom = System.nanoTime() + "" + random.nextInt(99999); SimpleDateFormat sdf =new SimpleDateFormat("YYMMdd"); String dayTime=sdf.format(new Date()); int hashcode= UUID.randomUUID().toString().hashCode(); if(hashcode<0) { hashcode=-hashcode; } int i = (int)(Math.random()*900 + 100); String value = dayTime+String.format("%010d",hashcode)+ i; long l = Long.parseLong(value); return l; }
标签:String,19,long,SimpleDateFormat,new,id From: https://www.cnblogs.com/ht-privete-logs/p/17174323.html