Limit an integer to certain number of digits and suffix '+'
Use less powerful language constructs

You use if and else

if (in &gt;= max) {
    return String.valueOf(max - 1) + "+";
} else  {
    return String.valueOf(in);
}


Using if and else duplicates return String.valueOf

Here the ternary operator comes to the rescue. It looks hard but really is very easy to use.

condition ? a : b


If condition is true, than a, else b. As easy as that.

You can now write return String.valueOf just one time:

return String.valueOf(in &gt;= max ? (max - 1) + "+" : in)