1

The idea would be to use a comparator to compare each String (I removed the part which was using the Set) :
public static void main(String [] args){
String [] names = { "0.0.1.1",
"1.0.1.1",
"0.0.1.2",
"0.0.1.5",
...