shift array by k
<p>i am working on a small java program, its very basic and one of my functions shifts the alphabet by a given key. i have got it working, but its shifting the wrong way, how can i make it shift the other direction?</p>

<pre><code>public static char[] ourAlphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};


    public  char[] shiftAlphabet(int key) {

            int length = ourAlphabet.length;

            char[] result = new char[length];

            for (int i=0; i &lt; length; i++)
            {
                result[(i+key+26)%length] = ourAlphabet[i];
            }

            return result;
    }
</code></pre>

<p>Im guessing its very simple, but its confused me!</p>

<p>For example;
 with a key 19 produces;
hijklmnopqrstuvwxyzabcdefg</p>

<p>when is should produce;
TUVWXYZABCDEFGHIJKLMNOPQRS</p>
