benchmark.java
来自「这个是关于设计模式的一些小例子」· Java 代码 · 共 18 行
JAVA
18 行
package test5;
public abstract class Benchmark {
public abstract void benchmark();
public final long repeat(int count) {
if (count <= 0)
return 0;
else {
long startTime = System.currentTimeMillis();
for (int i = 0; i < count; i++)
benchmark();
long stopTime = System.currentTimeMillis();
return stopTime - startTime;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?