Java tutorial
//package com.java2s; public class Main { public static String getDayOfMonthString(int day) { switch (day % 10) { case 1: return String.valueOf(day) + "st"; case 2: return String.valueOf(day) + "nd"; case 3: return String.valueOf(day) + "rd"; default: return String.valueOf(day) + "th"; } } }