I have been following Modulus for Mersenne's Prime and written following two methods:
First Method :
mersneMod(int x){
  while(x > 7){
    x = (x & 7) + (x >> 3);
  }
 return x == 7 ? 0 : x;
}
Second Method:
mod(int x){
  return x % 7;
}
When I bench mark these two method against numbers from 0 to 9000000
I get following numbers:
Method 1 : 65784647 ns
Method 2 : 2901699 ns
So far, I have been thinking method 1 should be faster but it is not. Can anyone explain what's going on inside % operator of java. Thanks!
