|
Timing array loop performance
public class TimeArray {
public static void main(String args[]) {
long startTime = System.currentTimeMillis();
for (int i = 0, n = Integer.MAX_VALUE; i < n; i++) {
;
}
long midTime = System.currentTimeMillis();
for (int i = Integer.MAX_VALUE - 1; i >= 0;) {
;
}
long endTime = System.currentTimeMillis();
System.out.println("Increasing: " + (midTime - startTime));
System.out.println("Decreasing: " + (endTime - midTime));
}
}
__________________
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. to our beloved Java Forums! (closes on July 27, 2008)
|