Online Java Compiler By
JavaTpoint.com
public class IntegerRotateRightExample2 { public static void main(String[] args) { int value = 20; // Get the binary equivalent System.out.println("Binary equivalent: "+Integer.toBinaryString(value)); // get the number of one's int Result = Integer.rotateRight(value, 2); System.out.println("Value after right rotation: "+Result); System.out.println("New Binary value after Rotated Right: "+Integer.toBinaryString(Result)); } }
Output