title: How to rotate array elements backwards
body: <p>I would like to know how could I take in a negative value for d in the following code. This means, how could I traverse the array backwards and rotate its elements.</p>
  
  <pre><code>catchArray(int [] arr, int d)
  {
      int [] bArr = new int[arr.length];
  
      for(int i = 0; i &lt; bArr.length; i++)
      {
          bArr[(i + d) % bArr.length] = arr[i];
      }
  
      return bArr;
  }
  </code></pre>
  
  <p>This is my answer for LeetCode Rotate Array assignment. Thank you in advance. </p>