System.currentTimeMillis()
This commit is contained in:
parent
57e12cb859
commit
fe9964116e
14
src/chapter5/Example11.java
Normal file
14
src/chapter5/Example11.java
Normal file
@ -0,0 +1,14 @@
|
||||
package chapter5;
|
||||
|
||||
public class Example11 {
|
||||
public static void main(String[] args) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
String test = "";
|
||||
for (int i = 0; i < 100000; i ++) {
|
||||
test += "test";
|
||||
}
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
System.out.println("程序运行的时间:" + (endTime - startTime) + "ms");
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user