I think this is what you're looking for:
public class alpha
{
public static void main(String[] args)
{
char[] alphabets = {'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'};
char last;
for(int i=0; i<20; i++)
{
last=alphabets[alphabets.length-1];
System.arraycopy(alphabets, 0, alphabets, 1, alphabets.length-1);
alphabets[0]=last;
// this is just some code to display the results
StringBuffer display = new StringBuffer(alphabets.length);
display.append(alphabets);
System.out.println(display.toString());
}
}
}
- public class alpha
- {
- public static void main(String[] args)
- {
- char[] alphabets = {'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'};
- char last;
-
- for(int i=0; i<20; i++)
- {
- last=alphabets[alphabets.length-1];
- System.arraycopy(alphabets, 0, alphabets, 1, alphabets.length-1);
- alphabets[0]=last;
-
- // this is just some code to display the results
- StringBuffer display = new StringBuffer(alphabets.length);
- display.append(alphabets);
- System.out.println(display.toString());
- }
- }
- }
and here is the result of running 20 iterations:
zabcdefghijklmnopqrstuvwxy
yzabcdefghijklmnopqrstuvwx
xyzabcdefghijklmnopqrstuvw
wxyzabcdefghijklmnopqrstuv
vwxyzabcdefghijklmnopqrstu
uvwxyzabcdefghijklmnopqrst
tuvwxyzabcdefghijklmnopqrs
stuvwxyzabcdefghijklmnopqr
rstuvwxyzabcdefghijklmnopq
qrstuvwxyzabcdefghijklmnop
pqrstuvwxyzabcdefghijklmno
opqrstuvwxyzabcdefghijklmn
nopqrstuvwxyzabcdefghijklm
mnopqrstuvwxyzabcdefghijkl
lmnopqrstuvwxyzabcdefghijk
klmnopqrstuvwxyzabcdefghij
jklmnopqrstuvwxyzabcdefghi
ijklmnopqrstuvwxyzabcdefgh
hijklmnopqrstuvwxyzabcdefg
ghijklmnopqrstuvwxyzabcdef