I get an integer and I need to convert to a month names in various locales:
Example for locale en-us:
1 -> January
2 -> February
Example for locale e
Here's how I would do it. I'll leave range checking on the int month
up to you.
import java.text.DateFormatSymbols;
public String formatMonth(int month, Locale locale) {
DateFormatSymbols symbols = new DateFormatSymbols(locale);
String[] monthNames = symbols.getMonths();
return monthNames[month - 1];
}