Allright. This is how I do it. Not my own code so I can not take credit for it and alas I do not remember where I got it. Additionally there might be a better solution (JSF based for example) since this uses basic JDK API.
I have a helper class called LocaleHelper and inside it these two methods:
And you can use it for example with a call like this:
I can explain it further but I think it should be pretty obvious what it does. It uses basic
java API as I explained so all the classes there are from
java.util package or from
java.text package