I have this array storing the suffix of some URLs the user is adding:
[U2, U3, U1, U5, U8, U4, U7, U6]
When I do this:
for
Just use Collections.sort() method after creating an ArrayList of your values like this:
ArrayList a = new ArrayList();
a.add("U2");
a.add("U1");
a.add("U5");
a.add("U4");
a.add("U3");
System.out.println("Before : "+a);
Collections.sort(a);
System.out.println("After : "+a);
Output :
Before : [U2, U1, U5, U4, U3]
After : [U1, U2, U3, U4, U5]