Reverse last 2 chars of a String
Rather than generating the substring for the last two chars and reversing it, you could simply add the last two chars in reverse order:

return str.substring(0, str.length() - 2)
    + str.charAt(str.length() - 1)
    + str.charAt(str.length() - 2);