Question: I want to sort string array based on on input string , for example thin we have these text

```
"united state"
"sample united"
"united kingdom"
"greece"
"uzbakestan"

```

so when user entered `united` , output will be :

```
"united state"
"united kingdom"
"sample united"
"greece"
"uzbakestan"

```

it shows `united` at first and sort them.

Answer: 
I am not sure I entirely understand what you are after - but if you want to print the strings that are "most similar" to your input string first:

You might want to create a [`Comparator<String>`](http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Comparator.html) that will compare between 2 strings according to their [levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance) from a 3rd string [your input String].

Using this comparator - you can sort your array using [`Arrays.sort(myArray,new MyCustomComparator(inputString))`](http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Arrays.html#sort%28java.lang.Object%5B%5D,%20java.util.Comparator%29).

If this is an `ArrayList` like the title suggest [conflicting title and question body] - you can use [`Collections.sort(myList,new MyCustomComparator(inputString))`](http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Collections.html#sort%28java.util.List,%20java.util.Comparator%29)
use this `Collections.sort(your_arraylist_obj);`