I am trying to make a method that will take each character from a string, convert each charcter to ascii and then populate an array with the ascii values.
The method I have made prints random characters so I must have an issue in this funtion.
public class Caesar {
public int[] stringToSymbolArray(String str){
str = str.toUpperCase();
int stringLength = str.length();
int[] symbolArray = new int[str.length()];
for (int i = 0; i < stringLength; i++) {
char character = str.charAt(i);
int ascii = (int) character;
symbolArray[i] = ascii;
}
return symbolArray;
}
}