• 随机数:
Random rand = new Random(47); // 产生随机算子。47 is seed. for incovating predicatable random number
int i = rand.nextInt(100); // 100 is range of random number

Random()

“Creates a new random number generator. This constructor sets the seed of the random number generator to a value very likely to be distinct from any other invocation of this constructor. “

The seed is probably a derivative of the current time, or the current time itself. That should be enough to be “very likely to be distinct from any other invocation”. Which, in essence, is most likely what you need, most of the time.

So why have another constructor that takes a seed?

Simply put, if you want to generate the same set of random numbers over and over, you use the same seed on your Random constructor. This is useful when doing experiments on different control sets, and you don’t want to bother creating your own table of random inputs, but still want the same set of random input on a different experiment/control set.

  • 类型确定

instanceof. String i = ''; i instanceof String. However, i instanceof int will have compiler error.

  • 常量

Long 3000L/l

Double 2.33D/d

Float 3.44f/F

int i1 = 0x23;
String ii = Integer.toBinaryString(i1);
  • for-循环

for(char s: 'hello world'.toCharArray()){

}

最新文章

  1. js数组的sort排序详解
  2. UImenuController
  3. 慕课网-安卓工程师初养成-4-14 Java 循环语句之多重循环
  4. ORA-12516: TNS: 监听程序无法找到匹配协议栈的可用句柄解决方法
  5. .net MVC全局定时器执行作业
  6. PowerShell运行cmd命令
  7. Quartz定时任务学习(四)调度器
  8. 查看Safari和钥匙串中的密码
  9. JAVA继承:编译与运行的关系(编译看左边,运行看右边)
  10. HTML5 Canvas圆盘抽奖应用(适用于Vue项目)
  11. vue2.0路由
  12. JS保留小数 去尾法 进一法 四舍五入法
  13. Servlet基本
  14. JavaScript -- Location
  15. node.js学习笔记(四)——EventEmitter
  16. svn 备份脚本
  17. android webservice 成功版(帅哥)
  18. Vue.js路由详解
  19. CentOS防火墙开启、关闭与开放指定端口
  20. MySQL下查询锁信息

热门文章

  1. 课上补做:用C语言编程实现ls命令
  2. ct
  3. docker开启远程访问
  4. TestLink环境搭建及用例导入
  5. 【安全测试自学】初探web安全处测试(二)
  6. java-框架-索引
  7. 【perl】simpleHTTP
  8. IntelliJ IDEA插件系列
  9. K数和问题
  10. centos7 根分区扩容