title: Rotation of the array means that each element is shifted right by one index, and the last element of the array is also moved to the first place
body: <p>For example, the rotation of <code>array A = [3, 8, 9, 7, 6] is [6, 3, 8, 9, 7]</code>. The goal is to rotate array A K times;
  that is, each element of A will be shifted to the right by K indexes.</p>
  
  <p>For example, given array <code>A = [3, 8, 9, 7, 6]</code> and <code>K = 3</code>, the function should return <code>[9, 7, 6, 3, 8]</code>.</p>
  
  <p>I want this in java.
  I have tried this.</p>
  
  <pre><code>public static int[] rotation(int[] a,int k) {
  
      int[] newArray = new int[a.length];
      for(int i = 0 ; i &lt; a.length ; i++) {
          int newPosition = (i + k)%a.length;
          newArray[newPosition] = a[i];
      }
      return newArray;
  }
  </code></pre>