import java.text.SimpleDateFormat;
import java.util.Date;

public class Test2 {
public static void main(String[] args){
SimpleDateFormat formatter2 = new SimpleDateFormat ("yyyy年MM月dd日 HH:mm:ss ");
SimpleDateFormat formatter = new SimpleDateFormat ("MMddHHmmss");
Date curDate = new Date(System.currentTimeMillis());//获取当前时间
String str = formatter.format(curDate);
String cur = str.substring(0,2);
String cur2 = str.substring(2,4);
String temp = (Integer.parseInt(cur)+Integer.parseInt(cur2))+""+str.substring(4);
int cur_id = Integer.parseInt(temp.substring(0,4))+Integer.parseInt(temp.substring(4));
System.out.println(cur_id);
}

}

java 生成不重复的随机数的更多相关文章

  1. Java生成不重复的随机数

    public class test { public static int[] Randoms(int number) { Random rand = new Random(); //创建一个新随机数 ...

  2. [转载][记录]javascript生成不重复的随机数

    参考链接:javascript生成不重复的随机数 项目播放视频,是无序的,有上下两个按钮,所以需要生成1,8不重复的随机数数组,如: ,,,,,,, 然后再split一次,就是数组了. 拿来主义了

  3. 2016/1/14 java生成指定范围的随机数

    java生成指定范围的随机数 package edu.sjtu.erplab.io; import java.util.Random; public class RandomTest { public ...

  4. Java生成不重复的数的方法

    在开发时要给某些表加上编号,而且编号是唯一的,自己用时间生成了下,觉得可能存在并发情况.所以在网上查了一下,就是随机生成.方法如下: //方法一(用当前时间精确到毫秒,截取任意几位) Date dat ...

  5. C#生成不重复的随机数(转)

    我们在做能自动生成试卷的考试系统时,常常需要随机生成一组不重复随机数的题目,在.net Framework中提供了一个专门用来产生随机数的类System.Random. 对于随机数,大家都知道,计算机 ...

  6. C#生成不重复的随机数

    在做能自动生成试卷的考试系统时,常常需要随机生成一组不重复的题目,在.net Framework中提供了一个专门用来产生随机数 http://www.jbxue.com/tags/suijishu.h ...

  7. C#生成无重复的随机数

    大一学期末的时候做课程设计时遇到过生成无重复随机数的问题,今天自己也写出来了: static int[] Create_Value() { Random ran = new Random(); //生 ...

  8. 用C#生成不重复的随机数

    我们在做能自动生成试卷的考试系统时,常常需要随机生成一组不重复的题目,在.net Framework中提供了一个专门用来产生随机数的类System.Random. 对于随机数,大家都知道,计算机不 可 ...

  9. C# 使用Guid类生成不重复的随机数

    什么是Guid GUID(全局唯一标识符)         全局唯一标识符(GUID,Globally Unique Identifier)是一种由算法生成的二进制长度为128位的数字标识符.GUID ...

随机推荐

  1. Interview with Oleg

    Interview with Oleg time limit per test 1 second memory limit per test 256 megabytes input standard ...

  2. linux视频学习3(linux安装,shell,tcp/ip协议,网络配置)

    linux系统的安装: 1.linux系统的安装方式三种: 1.独立安装linux系统. 2.虚拟机安装linux系统. a.安装虚拟机,基本是一路点下去. b.安装linux. c.linux 安装 ...

  3. redis 队列缓存 + mysql 批量入库 + php 离线整合

    问题分析 思考:应用网站架构的衍化过程中,应用最新的框架和工具技术固然是最优选择:但是,如果能在现有的框架的基础上提出简单可依赖的解决方案,未尝不是一种提升自我的尝试. 解决: 问题一:要求日志最好入 ...

  4. java 常见异常总结

    异常1:java.util.NoSuchElementException: No line found 原因:Java 是顺序执行的 你执行到.close() 后就代表 你关闭了 流,你再去调用已经被 ...

  5. FZU 2091 播放器(栈应用)

    栈基础应用 #include<iostream> #include<cstdio> #include<cstring> #include<vector> ...

  6. L9,a cold welcome

    expression: a large crowd of 一大群 in twenty minutes’time 20分钟之后 一些时间使用的介词 in two year‘s time on Satur ...

  7. JavaScript基础教程

    功能介绍: (1)数据验证 弹出提示的对话框,产生判断的效果. (2)气泡提示窗口 右下角等等一类的窗口 (3)产生新窗口 (4)无边框窗口背景变灰,也是可以节约系统资源的

  8. s-palindrome

    s-palindrome Let's call a string "s-palindrome" if it is symmetric about the middle of the ...

  9. html常见标签使用

    <body> <!--标题标签--> <h1></h1> <h2></h2> <h3></h3> < ...

  10. iOS:判断昨天,今天,今年

    - (BOOL)isThisYear { // 日历 NSCalendar *calendar = [NSCalendar currentCalendar]; NSInteger nowYear = ...