- Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathAutoBoxingPerf.java
More file actions
Latest commit
23 lines (19 loc) · 738 Bytes
/
Copy pathAutoBoxingPerf.java
File metadata and controls
23 lines (19 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
packagech09;
publicclassAutoBoxingPerf {
publicstaticvoidmain(String[] args) {
longstartTime;
// int 원시형 1억 번 계산
startTime = System.currentTimeMillis();
intsum1 = 0;
for (inti = 0; i < 100000000; i++)
sum1 += i;
System.out.printf("int 원시형 1억 번 계산: %s밀리초\n", System.currentTimeMillis() - startTime);
// ---
// Integer 참조형 1억 번 계산
startTime = System.currentTimeMillis();
Integersum2 = 0;
for (inti = 0; i < 100000000; i++)
sum2 += i;
System.out.printf("Integer 참조형 1억 번 계산: %s밀리초\n", System.currentTimeMillis() - startTime);
}
}