日期:2014-05-20 浏览次数:20829 次
public class TestClass {
public static void main(String[] args) {
int i = Integer.MAX_VALUE;
int count = 0;
long startTime = System.currentTimeMillis();
long tempTime = startTime;
while (true) {
i++;
// if (i % 10000000 == 0) {
// System.out.println(i);
// }
if (i == Integer.MAX_VALUE) {
i = Integer.MIN_VALUE; //手动赋值
count++;
System.out.println("Finish run " + count + " times loop, cost "
+ (System.currentTimeMillis() - tempTime) + " ms.");
tempTime = System.currentTimeMillis();
}
if (count == 10) {
break;
}
}
System.out.println("Total cost " + (System.currentTimeMillis() - startTime) / 1000 + " s.");
}
}