Created
October 16, 2012 05:20
-
-
Save lostdj/3897345 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Loop { | |
public static volatile int k = 10000; | |
public static volatile int s = 0; | |
public static volatile int i = 0; | |
public static volatile int j = 0; | |
public static void foo() | |
{ | |
for (s=0,i=0;i<k;i++) { | |
for (j=0;j<k;j++) | |
s+=i*j; | |
} | |
System.out.println(s); | |
} | |
public static void main(String[] args) throws Exception { | |
// Warm-up. | |
foo(); | |
foo(); | |
foo(); | |
foo(); | |
foo(); | |
foo(); | |
foo(); | |
System.out.println(System.currentTimeMillis()); | |
foo(); | |
System.out.println(System.currentTimeMillis()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment