Here you go. I did not see the need to create a separate class to return one string character to an array index, since I only have to make that conversion once, where I increment the array value (the part with [c-'a']).
The user can terminate the program by pressing enter, ie., enter an empty string.
import java.util.Scanner;
public class Analyzer
{
public static void Analyze(String line)
{
int[] histogram = new int[26];
for(int i=0; i<line.length(); i++) {
char c = Character.toLowerCase(line.charAt(i));
if ((c >='a' && c <= 'z')) {
histogram[c-'a']++;
}
}
for(int i=0; i<26; i++) {
if (histogram[i] > 0) {
System.out.format("%c: %d times.\\", 'a'+i, histogram[i]);
}
}
}
public static void main(String[] args)
{
String line = "";
Scanner scan = new Scanner(System.in);
do {
System.out.print("Enter a string: ");
line = scan.nextLine();
if (line.length()>0) {
Analyze(line);
}
} while (line.length() > 0);
}
}