for (int i = 0; i < s.length(); ++i)
{
if (s.charAt(i) >= \'A\' && s.charAt(i) <= \'Z\')
{
++array[s.charAt(i) - \
array
seems to be a "counter per capital letter". By subtracting character 'A'
from an arbitrary character in a string, you get the letter's index in the array:
'A' - 'A' == 0
'B' - 'A' == 1
'C' - 'A' == 2
To understand this, you should understand, that Java treats char
the same as (unsigned) short
. Hence, you can make calculations with char