Home > Java > javaTutorial > Java unique code generation

Java unique code generation

大家讲道理
Release: 2016-11-10 10:25:37
Original
1401 people have browsed it

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;
Copy after login


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template