I have this months array:
[\"January\", \"March\", \"December\" , \"October\" ]
And I want to have it sorted like this:
[\"
Talking from a Java POV, I'm going to pimp (as I often do) google-collections (soon to be replaced with Guava):
Arrays.sort(myMonths, Ordering.explicit("Jan", "Feb", "Mar", ....));
... and you're done.
Don't write it yourself if someone else has done it, probably more efficiently and with a nicer API than you probably would.
Not helpful in the general case, but just in case any Java folk have the same problem...