Inspired by this question,
Now visible only for users with > 10k rep
I came up with the following code:
$cat loop.c int main(
The Java JIT compiler is smart enough to optimize the loop away, while your C compiler seems to have most of the optimizations turned off.
So you are really comparing the time to start up the Java machine with the time it takes unoptimized C code to count to 2 billion.