Use the charAt function to get each individual character in the string (you'll have to use a for loop from i=0 to the length of the string). For each character, convert it to a number. If it's ASCII you can just subtract the appropriate value and typecast it. Once it is a number, use the % operator to test if it is divisible by two. Have two counter variables (one for evens, one for odds) and increment the appropriate one.