The singular plural variation is an annoyance that you’ve probably had to deal with many times.

On a lot of scenarios you can just get rid of the problem with something like this:

public static String pluralizer(int count, String singular, String plural) {
    return (count==1) ? singular : plural;

So if you were populating a dashboard with users you would feed the method with singular - user and plural - users. But recently I was browsing StackOverflow and stumbled across this answer, that reflects the intrinsics of different languages, in this particular case, Czech.

// uživatel means user in Czech, 5 users has a particular form
1 uživatel
2 uživatelé
3 uživatelé
4 uživatelé
5 uživatelů

Java 11 has a handy construct called ChoiceFormat that allows you to deal with this scenario in a very elegant way:

ChoiceFormat fmt = new ChoiceFormat("1#uživatel | 1.0< uživatelé | 4.0< uživatelů");
System.out.println(fmt.format(1)); // prints uživatel
System.out.println(fmt.format(4)); // prints uživatelé
System.out.println(fmt.format(5)); // prints uživatelů
plurals, by the camera of Geran de Klerk

There is another project that’s a worthy mention, Evo Inflector. Based on the work of Damian Conway – “An Algorithmic Approach to English Pluralization” – does wonders for most cases of the English language. But it’s an external dependency, more than often will be overkill to what you actually need and only has guaranteed coverage to ~70% of the words.

Link to Oracle’s ChoiceFormat documentation.