Is there a better way to do this?
/* Compares two characters.
If ch1 is alphabetically smaller than ch2, return true
If ch1 is equal to ch2 or is alphabetically greater, return false
*/
public static boolean smallestCharacter(char ch1, char ch2) {
return Character.parseChar((new String(ch1)).toLowerCase()) <
Character.parseChar((new String(ch2)).toLowerCase())
}
Update: It can be assumed that ch1, and ch2 are both characters from the english alphabet. If you have a similar question, but can’t assume that ch2 and ch2 are English characters, I suggest reading @Tedd Hopp’s Answer.
what about