title: What is the best way to implement a circular array byte shift in java?
body: <p>If the shifting is not always the same, i.e I may have to use the same function to resize 2 or 4 characters, what would be a good way to circular shift the values of an array of bytes 2 positions * a parameter? This is what I have so far</p>
  
  <pre><code>for(int j=0; j&lt;param; j++){
          if(j == 0){
              for(int i=0; i&lt;myArray.length;i++){
                  result[i] = (byte) (myArray[i]&lt;&lt;2); 
              }
          } else{
              for(int i=0; i&lt;result.length;i++){
                  if((result.length-i) &gt; 2){
                      result[i] = (byte) (result[i]&lt;&lt;2);
                  }
              }   
          }
      }
  </code></pre>
  
  <p>Summing up, I have to circular shift the values of myArray twice times param and return the result in the array 'result'. I don't get how to do this when the parameter 'param' is not fixed. </p>