Java Data Type Tutorial - Java Integer.rotateRight(int i, int distance)








Syntax

Integer.rotateRight(int i, int distance) has the following syntax.

public static int rotateRight(int i,  int distance)

Example

In the following code shows how to use Integer.rotateRight(int i, int distance) method.

public class Main{
  public static void main(String args[]) {
    int n = 1;/*from  ww  w . j av  a2s. co  m*/
    for (int i = 0; i < 16; i++) {
      n = Integer.rotateRight(n, 1);
      System.out.println(n);
    }

  }
}

The code above generates the following result.