欢迎使用CSDN-markdown编辑器
2016-07-26 15:42
399 查看
public static String getOrderNo(final String prefix) { DateFormat df = new SimpleDateFormat("yyMMddHHmm"); String MI = ""; String last = ""; Date date = null; synchronized (df) { date = new Date(); Calendar CD = Calendar.getInstance(); MI = CD.get(Calendar.MILLISECOND) + ""; if (MI.length() < 3) { Random random = new Random(); MI = (random.nextInt(999 - 100 + 1) + 100) + ""; } Random random = new Random(); last = (random.nextInt(999 - 100 + 1) + 100) + ""; } return prefix + df.format(date) + MI + last; }
相关文章推荐
- Linux type命令
- C#开发中常用加密解密方法解析
- python创建文件
- Oracle的sequence的重置
- Tomcat的JVM设置和连接数设置
- 基于 Token 的身份验证
- NF_HOOK conntrack分析[NAT篇]
- 第四天 像素翻转
- 源码-PL/SQL从入门到精通-第十六章-动态SQL语句-Part 1
- Java设计模式——外观模式
- Win7下配置PHP+Nginx
- LightOJ 1013 Love Calculator(LCS)
- 话说验证码识别
- redis:sentinel配置及测试
- war包中少了class文件
- C3P0连接池配置和实现详解(转)
- 数据挖掘
- 廖雪峰JS教程--对象
- 使用yum安装CDH Hadoop集群
- 蒲公英内测平台使用说明