forked from zaiyunduan123/Java-Summarize
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForTest.java
More file actions
28 lines (25 loc) · 701 Bytes
/
ForTest.java
File metadata and controls
28 lines (25 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package jdk;
/**
* Created by jiangyunxiong on 2018/7/26.
*/
public class ForTest {
public static void main(String[] args) {
int[] array = new int[10000000];
Long time = System.currentTimeMillis();
for (int i:array) {
int m = 1;
}
System.out.println(System.currentTimeMillis());
time = System.currentTimeMillis();
for (int i =0 ;i<array.length;i++) {
int m = 1;
}
System.out.println(System.currentTimeMillis());
time = System.currentTimeMillis();
int i=0;
while (i<array.length) {
i++;
}
System.out.println(System.currentTimeMillis());
}
}