一个effective java中的效率问题
时间:2014-01-23 01:18:51
收藏:0
阅读:315
package com.liuc; public class AutoPackage { public static void main(String[] args) { long start=System.currentTimeMillis(); long sum = 0L; for (int i = 0; i < Integer.MAX_VALUE; i++) { sum += i; } long end=System.currentTimeMillis(); System.out.println((end-start)/1000); } }
运行时间19S
和下面这个程序package com.liuc; public class AutoPackage { public static void main(String[] args) { long start=System.currentTimeMillis(); Long sum = 0L; for (int i = 0; i < Integer.MAX_VALUE; i++) { sum += i; } long end=System.currentTimeMillis(); System.out.println((end-start)/1000); } }
运行时间19S
原文:http://blog.csdn.net/shanhuhau/article/details/18665317
评论(0)