int num = 10000;
long l = System.currentTimeMillis();
Integer n = null;
for (int i = 0; i < num; i++)
{
n = new Integer(new Random().nextInt(num*50));
Thread.sleep(1);
}
l -= System.currentTimeMillis();
System.out.println("random:"+(-l)+"ms");out: 19828ms,ji基本上一个Random花了1ms why?
long l = System.currentTimeMillis();
Integer n = null;
for (int i = 0; i < num; i++)
{
n = new Integer(new Random().nextInt(num*50));
Thread.sleep(1);
}
l -= System.currentTimeMillis();
System.out.println("random:"+(-l)+"ms");out: 19828ms,ji基本上一个Random花了1ms why?
解决方案 »
- 【新人】file的使用,小程序是否写错了路径??
- java如何解析(读取和写入)xml文档?
- 我显示了很多图片出现了Exception in thread "Image Fetcher 3" java.lang.OutOfMemoryError: Jav
- 死马当活马医!
- 关于设置lock的一个问题
- 求教:有谁用过eBay SDK进行程序开发?
- 高分求计算有效工作日的算法
- NTEXT字段的特殊字符更新问题
- petstore1.3.1_02在weblogic上怎么安装阿,运行setup.bat说路径不对,不会做个程序安装都这么麻烦吧
- 掌握向上转型与向下转型
- 如何处理这个字符串???????????
- SplitPane设置左右大小问题
目的是什么?
有什么特殊要求吗?