JAVA: Why this logic for comparator not working?

I solved this problem, but when I am trying to put all the conditions in single comparator, it is not working,

Arrays.sort(s,new Comparator<String>(){
	   
	   public int compare(String s1,String s2){
	   	  int comp = 0 ;

	   	  	if(s1.startsWith(s2))
	   	  		comp = s2.length()-s1.length();
	   	  	else if(s2.startsWith(s1))
	   	  		comp = s1.length()-s2.length();
	   	  	else
	   	  		  comp = s1.compareTo(s2);
	   	  	   
	   	   return comp ;
	}

});