Created
January 14, 2013 19:36
-
-
Save mastersobg/4532676 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 Test { | |
static class Timer { | |
long time; | |
long current; | |
public void reset() { | |
time = 0; | |
} | |
public void start() { | |
current = System.currentTimeMillis(); | |
} | |
public void end() { | |
time += System.currentTimeMillis() - current; | |
} | |
} | |
void test() { | |
Timer t = new Timer(); | |
t.start(); | |
byte a = 10; | |
byte b = 20; | |
byte c = 0; | |
for(long i = 0; i < 10000000000l; ++i) { | |
c += a + b; | |
} | |
t.end(); | |
System.out.println("Total time = " + t.time + " value = " + c); | |
} | |
public void run() { | |
test(); | |
test(); | |
test(); | |
test(); | |
test(); | |
test(); | |
test(); | |
test(); | |
} | |
public static void main(String []args) { | |
new Test().run(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment