I have a list of file names that are named like 0.jpg,1.jpg
etc.. and I want to order them in descending fashion but seems that I'm having trouble doing that. Also I've noticed that the ascending ordering is not quite like I want to, here is an example:
file 1.jpg
file 10.jpg
file 100.jpg
file 101.jpg
...
file 109.jpg
file 11.jpg
So my question is how can I do a descending ordering but correctly? Here is what im I doing right now:
Collections.sort(files, new Comparator<File>() {
@Override
public int compare(File s1, File s2) {
return s1.getName().compareToIgnoreCase(s2.getName());
}
});