I have a question regarding the checking of possible permutations of something by using loops:
An encrypted sentence was formed by using a 26 slot char array. This array contained a randomized alphabet (every letter occurring only once), and every letter of the original unencrypted sentence was changed to whatever letter the array had at it's xth slot, x being the original characters position in the alphabet.
For example, if the encryption array had been {'q','w','e','r','t',...,'m'}, then the message "abez" would have become "qwtm" because:
a is the 1st letter of the alphabet and the 1st slot of the array contained a 'q'
b is the 2nd letter of the alphabet and the 2nd slot of the array contained a 'w'
e is the 5th letter of the alphabet and the 5th slot of the array contained a 't'
...
I'd like to bruteforce the encrypted sentence by checking every permutation for the keyword "morning".
How do I do this correctly? I already wrote a method that checks whether a char[] is contained in another char[], but how can I loop through the char[] permutations?