I have a string array in Java. I need to sort it by the number of character "a"s within the word (decreasing order). If some words contain same number of character "a", then I need to sort those words by their lengths(decreasing order). And if the length is same, then alphabetically.
I can loop the array to find the number of "a"s in the words. But I don't know how to continue. Plus I am a newbie in Java I don't know if this is a good way to do in Java and if there are some built-in functions which I can use to solve this problem. That's why I am asking here to get some practical ideas about sorting.
I've already read the documentation and tried to understand how I can use comparable, made some searches on the different forums but haven't found a solution for my problem. That's why I am asking for help here telling the exact problem that I have to solve.