int[] buildCharFreqTable(string phrase){
int[] tab = new int[Character.getNumericValue('z') - Character.getNumericValue('a') + 1];
for (char c : phrase.toCharArray()) {
int x = getCharNumber(c);
if ( x != -1){
tab[x]++;
}
}
return tab;
}
This is a function that counts how many times each characters appear in a phrase. But I don't understand the line
int[] tab = new int[Character.getNumericValue('z') - Character.getNumericValue('a') + 1];
What does this line do and why do we have to use
Character.getNumericValue('z') - Character.getNumericValue('a') + 1
Thanks in advance