I am wondering how to implement a circular right shift by k of the bitstring represented by the int bits.
int
public int r
This should work:
return (bits >>> k) | (bits << (Integer.SIZE - k));
Also see the Wikipedia article on circular shifts.