public static String method(String s2,String s1)
{
String max="";
String min="";
max=(s1.length()>s2.length())?s1:s2;
min=(s1==max)?s2:s1;
System.out.println(max+"----"+min);
for(int x=0;x<min.length();x++
for(int y=0,z=min.length()-x;z!=min.length()+1;y++,z++)
{
String temp=min.substring(y,z);
if(max.contains(temp))
return temp;
}
return "";//为什么呢?
}
|
|