Hi,
Is there any java functions are availble to find mostly repeated characters in string ?
Thanks
Not in the standard API, no.
May I guess that you have been set this as an exercise?
you might try this(though no guarantees), after creating your main method:
public char getCharacterNumber(string st) {
char[] c = st.toCharArray();
String str = "....."(whatever you want it to be);
int[] arrayCount = new int[equal to length of str];
for (char a : c) {
for (int i = 0; i < str.length()-1; i++) {
if (str.charAt(i) == a) {
arrayCount[i]++;
}
}
}
something along this line may help. I would also recommend getting Java Programming by Y. Daniel Lang. It's the book I used in my programming Fundamentals class, and it's extremely helpful
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.