@Test public void shouldOrdinalize() { ordinalize(1, "1st"); ordinalize(2, "2nd"); ordinalize(3, "3rd"); ordinalize(4, "4th"); ordinalize(5, "5th"); ordinalize(6, "6th"); ordinalize(7, "7th"); ordinalize(8, "8th"); ordinalize(9, "9th"); ordinalize(10, "10th"); ordinalize(11, "11th"); ordinalize(12, "12th"); ordinalize(13, "13th"); ordinalize(14, "14th"); ordinalize(15, "15th"); ordinalize(16, "16th"); ordinalize(17, "17th"); ordinalize(18, "18th"); ordinalize(19, "19th"); ordinalize(20, "20th"); ordinalize(21, "21st"); ordinalize(22, "22nd"); ordinalize(23, "23rd"); ordinalize(24, "24th"); ordinalize(25, "25th"); ordinalize(26, "26th"); ordinalize(27, "27th"); ordinalize(28, "28th"); ordinalize(29, "29th"); ordinalize(30, "30th"); ordinalize(31, "31st"); ordinalize(32, "32nd"); ordinalize(33, "33rd"); ordinalize(34, "34th"); ordinalize(35, "35th"); ordinalize(36, "36th"); ordinalize(37, "37th"); ordinalize(38, "38th"); ordinalize(39, "39th"); ordinalize(100, "100th"); ordinalize(101, "101st"); ordinalize(102, "102nd"); ordinalize(103, "103rd"); ordinalize(104, "104th"); ordinalize(200, "200th"); ordinalize(201, "201st"); ordinalize(202, "202nd"); ordinalize(203, "203rd"); ordinalize(204, "204th"); ordinalize(1000, "1000th"); ordinalize(1001, "1001st"); ordinalize(1002, "1002nd"); ordinalize(1003, "1003rd"); ordinalize(1004, "1004th"); ordinalize(10000, "10000th"); ordinalize(10001, "10001st"); ordinalize(10002, "10002nd"); ordinalize(10003, "10003rd"); ordinalize(10004, "10004th"); ordinalize(100000, "100000th"); ordinalize(100001, "100001st"); ordinalize(100002, "100002nd"); ordinalize(100003, "100003rd"); ordinalize(100004, "100004th"); }
public String ordinalize( int number ) { int remainder = number % 100; String numberStr = Integer.toString(number); if (11 <= number && number <= 13) return numberStr + "th"; remainder = number % 10; if (remainder == 1) return numberStr + "st"; if (remainder == 2) return numberStr + "nd"; if (remainder == 3) return numberStr + "rd"; return numberStr + "th"; }
Inflector { public String ordinalize( int number ) { int remainder = number % 100; String numberStr = Integer.toString(number); if (11 <= number && number <= 13) return numberStr + "th"; remainder = number % 10; if (remainder == 1) return numberStr + "st"; if (remainder == 2) return numberStr + "nd"; if (remainder == 3) return numberStr + "rd"; return numberStr + "th"; } }
Inflector { public String ordinalize( int number ) { int remainder = number % 100; String numberStr = Integer.toString(number); if (11 <= number && number <= 13) return numberStr + "th"; remainder = number % 10; if (remainder == 1) return numberStr + "st"; if (remainder == 2) return numberStr + "nd"; if (remainder == 3) return numberStr + "rd"; return numberStr + "th"; } Inflector(); protected  Inflector( Inflector original ); }
Inflector { public String ordinalize( int number ) { int remainder = number % 100; String numberStr = Integer.toString(number); if (11 <= number && number <= 13) return numberStr + "th"; remainder = number % 10; if (remainder == 1) return numberStr + "st"; if (remainder == 2) return numberStr + "nd"; if (remainder == 3) return numberStr + "rd"; return numberStr + "th"; } Inflector(); protected  Inflector( Inflector original ); static final Inflector getInstance(); @Override Inflector clone(); String pluralize( Object word ); String pluralize( Object word,
                             int count ); String singularize( Object word ); String lowerCamelCase( String lowerCaseAndUnderscoredWord,
                                  char... delimiterChars ); String upperCamelCase( String lowerCaseAndUnderscoredWord,
                                  char... delimiterChars ); String camelCase( String lowerCaseAndUnderscoredWord,
                             boolean uppercaseFirstLetter,
                             char... delimiterChars ); String underscore( String camelCaseWord,
                              char... delimiterChars ); String capitalize( String words ); String humanize( String lowerCaseAndUnderscoredWords,
                            String... removableTokens ); String titleCase( String words,
                             String... removableTokens ); String ordinalize( int number ); boolean isUncountable( String word ); Set<String> getUncountables(); void addPluralize( String rule,
                              String replacement ); void addSingularize( String rule,
                                String replacement ); void addIrregular( String singular,
                              String plural ); void addUncountable( String... words ); void clear(); }
Inflector { public String ordinalize( int number ) { int remainder = number % 100; String numberStr = Integer.toString(number); if (11 <= number && number <= 13) return numberStr + "th"; remainder = number % 10; if (remainder == 1) return numberStr + "st"; if (remainder == 2) return numberStr + "nd"; if (remainder == 3) return numberStr + "rd"; return numberStr + "th"; } Inflector(); protected  Inflector( Inflector original ); static final Inflector getInstance(); @Override Inflector clone(); String pluralize( Object word ); String pluralize( Object word,
                             int count ); String singularize( Object word ); String lowerCamelCase( String lowerCaseAndUnderscoredWord,
                                  char... delimiterChars ); String upperCamelCase( String lowerCaseAndUnderscoredWord,
                                  char... delimiterChars ); String camelCase( String lowerCaseAndUnderscoredWord,
                             boolean uppercaseFirstLetter,
                             char... delimiterChars ); String underscore( String camelCaseWord,
                              char... delimiterChars ); String capitalize( String words ); String humanize( String lowerCaseAndUnderscoredWords,
                            String... removableTokens ); String titleCase( String words,
                             String... removableTokens ); String ordinalize( int number ); boolean isUncountable( String word ); Set<String> getUncountables(); void addPluralize( String rule,
                              String replacement ); void addSingularize( String rule,
                                String replacement ); void addIrregular( String singular,
                              String plural ); void addUncountable( String... words ); void clear();  }