/** * Rotates value n bits left through the sign. * * @param value Value to rotated. * @param n how many bits to rotate left. * must be in range 0..31 * @return Value rotated. */ public static int rotateLeft ( int value, int n ) { return( value << n ) | ( value >>> (32 - n) ); } /** * Rotates value n bits right through the sign. * * @param value Value to rotated. * @param n how many bits to rotate night. * must be in range 0..31 * @return Value rotated. */ public static int rotateRight ( int value, int n ) { return( value >>> n ) | ( value << (32- n) ); }