Hi guys,
I have a password key which is "password12Qcb6z:!sh:&BYztwYTPM" which i have repeating a number of times in a 1d array.
What i am trying to create an array where numbers are assigned starting with 1, and they are assigned first by alphabetical order, and second, where the same letter appears twice, by position in the word.
for example:
C O N V E N I E N C E
1 10 7 11 3 8 6 4 9 2 5
my key is alot longer than "CONVENIENCE" its roughly 328 characters long ("password12Qcb6z:!sh:&BYztwYTPM" repeated ). so i have a 1d int array array which i want to map out 1-328 following the rule above starting wit the lowest character in its ascii values 32 = SPACE to ~ = 127. so i then have a array mapping out 1-328 ...
I have this code so far
int v=0, count=0, r=32; // 33 is the first usable ascii character in test file int[] colprintorder = new int[numberofcols]; while(r<=127) // loop unit last usable ascii char { for(int i=0;i<passwordinbyte.length;i++) // go through each cell of the array { if (r == passwordinbyte[i]) // if the value of r is the same as what is in passwordinbyte map its position storing in colprintorder { colprintorder[count] = i ; count++; // next cell in the array } } r++; // look for the next characters ascii value 32-127 } for(int a=0; a<colprintorder.length; a++) // print out colprint order { System.out.println( colprintorder[a] + " " ); } System.out.println("lengthhrr" +passwordinbyte.length);
Here is my output using the code snippet above:
http://i57.photobucket.com/albums/g2...e2k/lolcat.jpg
it appears theres somthing wrong with my code but i dont know what can you guys help me ?
thank you