int n;
EtmPoint point1 = etmMonitor.createPoint("test:objects");
for (n = 0; n < 1000000; n++) {
Integer t = 0;
t = 10;
t = 11;
}
point1.collect();
EtmPoint point = etmMonitor.createPoint("test:primitives");
for (n = 0; n < 1000000; n++) {
int t = 0;
t = 10;
t = 11;
}
point.collect();
etmMonitor.render(new SimpleTextRenderer());
如果你想检查一个 null值,那么 Integer是最好的,但是如果你想比较整数,那么 int 可能更好。在下面的示例中,我使用整数 c = 1000和 d = 1000,并比较它返回 false,但是在使用 int 的情况下,它们将返回 true。
public class IntegerCompare {
public static void main(String[] args) {
int a = 1000;
int b = 1000;
Integer c = 1000;
Integer d = 1000;
if (a == b) {
System.out.println("int Value Equals");
}
if (c == d) {
System.out.println("Integer value Equals");
} else {
System.out.println("Integer Value Not Equals");
}
}
}