zoukankan      html  css  js  c++  java
  • NumberUtils (idUtils ) 带时分秒

    public class NumberUtils {
        
        /**
         * @param prefix+yyyyMMddHHmmssSSS+2random
         * @return
         */
        public  static String  generateNumber(String prefix) {
            LocalDateTime ldt = LocalDateTime.now();
            DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
            //to the millisecond
            String milliSecond = ldt.format(dtf);
            prefix+=milliSecond;
            /*Not use the random as current data growth */
            String rondomtail="";
            Random random=new Random();
            for(int i=0;i<2;i++){
                rondomtail+=random.nextInt(10);
            }
            //    2020 06 05 14 25   01947 25
            return prefix+rondomtail;
        }
        
        
        /**
         * @param yyyyMMddHHmmssSSS+2random
         * @return
         */
        public  static String  genNO() {
            LocalDateTime ldt = LocalDateTime.now();
            DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
            //to the millisecond
            String milliSecond = ldt.format(dtf);
            /*Not use the random as current data growth */
            String rondomtail="";
            Random random=new Random();
            for(int i=0;i<2;i++){
                rondomtail+=random.nextInt(10);
            }
            //    2020 06 05 14 25   01947 25
            return milliSecond+rondomtail;
        }
        
        
        /**
         * 唯一值  uui + 3 random
         */
        public static String genUUID() 
        {
             String uuid = UUID.randomUUID().toString().replaceAll("-", "");
              /*Not use the random as current data growth */
                String rondomtail="";
                Random random=new Random();
                for(int i=0;i<3;i++){
                    rondomtail+=random.nextInt(10);
                }
            return uuid+rondomtail;
        }
    
        
  • 相关阅读:
    python+selenium初学者常见问题处理
    pycharm的这些配置,你都知道吗
    巧用浏览器F12调试器定位系统前后端bug
    dsu + lca
    indeed2017校招在线编程题(网测)三
    rolling hash
    ac自动机
    indeed 第二次笔试题
    vmware以及schlumberger题解
    2017 google Round C APAC Test 题解
  • 原文地址:https://www.cnblogs.com/lshan/p/14120538.html
Copyright © 2011-2022 走看看