Getting inverse of a transposition key I'm new to security stuff and I have some questions about the keys of transposition cryptography.

If I'm given the encoding key to a transposition cipher, how do I get the decoding key for it? I tried googling but couldn't find any steps on the calculation for it. For example, on several crypto-related websites there are these nifty tools where, when I enter 4 3 1 6 2 5 I would get 3 5 2 1 6 4… but why and how?
The key is obtained by taking the encryption steps in reverse.
For example, let's encrypt the word "United" with that 4 3 1 6 2 5 key. 
The first step is to take the 4th letter, a "t" and make it the first.
In the decryption, this first ciphertext letter must go to the 4th place again.
So the fourth step in the decryption, must be to look at what is in the first position - a "t" - and put that back in the fourth place again. Indeed we see in the decryption key that "1" is the value its fourth member.
By continuing these steps, you can derive the inverse key.

Here is a little code snippet that does the calculation. 

static int[] inverse_key( int[] key )
{
    int[] inverse_key = new int[ key.length ];
    for ( int i = 0; i &lt; key.length; i++ )
    {
        inverse_key[ key[ i ] - 1 ] = i + 1;
    }
    return inverse_key;
}


The "-1" and "+1" in the code are because arrays in most programming languages are 0-based; they do not relate to the actual algorithm.