I am writing a program using J2ME and my goal is to count how many times each character appears in a string.
I am not very good at java so the way i see i should do this is create 2 arrays.
First array is used to hold characters. Second array is used to keep count
The program goes through checks if the first character of the string is in the first array. If it isn't, then put it in the first position in the array and add 1 to its count in the second array. This loops through until every character has been counted.
I feel this method seems kinda long winded so i was wondering if someone could offer me a better way of doing it?
I have searched and people have said use hash maps. I dont know what they are but it looks like they are not available in J2ME anyway.