public String shortOrdinal(long n) {
        String str = Long.toString(n);

        if (n < 0) {
            n = -n;
        }

        n %= 100;

        if (n >= 10 && n <= 20) {
            str = str.concat("th");
        }
        else {
            if (n > 20) n %= 10;

            switch ((int) n) {
            case 1:
                str = str.concat("st"); break;
            case 2:
                str = str.concat("nd"); break;
            case 3:
                str = str.concat("rd"); break;
            default:
                str = str.concat("th"); break;
            }
        }

        return str;
    }
public String shortOrdinal ( long n ) { String str = Long . toString ( n ) ; if ( n < 0 ) { n = - n ; } n %= 100 ; if ( n >= 10 && n <= 20 ) { str = str . concat ( "th" ) ; } else { if ( n > 20 ) n %= 10 ; switch ( ( int ) n ) { case 1 : str = str . concat ( "st" ) ; break ; case 2 : str = str . concat ( "nd" ) ; break ; case 3 : str = str . concat ( "rd" ) ; break ; default : str = str . concat ( "th" ) ; break ; } } return str ; }
A function that converts an integer to a short ordinal value.
i.e. 1st, 2nd, 3rd etc.

@param n the number to convert

@return a String containing the short ordinal value of the specified
number