public static String fixCase(String s) {
        if (s == null || s.length() == 0) {
            return s;
        }
        if ( Character.isUpperCase(s.charAt(0))
                && (s.length() == 1 || Character.isLowerCase(s.charAt(1)))) {
            s = s.toLowerCase();
        }
        return s;
    }
public static String fixCase ( String s ) { if ( s == null || s . length ( ) == 0 ) { return s ; } if ( Character . isUpperCase ( s . charAt ( 0 ) ) && ( s . length ( ) == 1 || Character . isLowerCase ( s . charAt ( 1 ) ) ) ) { s = s . toLowerCase ( ) ; } return s ; }
Fixes case of a word: Str becomes str, but URL stays URL.
@param s Word to be fixed
@return all-lowercase or all-uppercase word.