package sorttest; /** */ /*** 正反求取最大公共子串*/ public class Turn ... { String ss=""; String st=""; public void sur(String a,String b)...{ int i=0; int j=0; while(true)...{ while(i<a.length()); while(j<b.length()); String dede=this.compile(a.charAt(i), b.charAt(j)); i++; j++; if(i==a.length()-1)...{ break; } } } public String compile(char a,char b)...{ if(a==b)...{ st+=a; } return st; } public String Turnto(String str)...{ String turnstr=""; for (int i= str.length() - 1; i > -1; i--) ...{ turnstr+=str.charAt(i); } return turnstr; } public static void main(String[] args) ...{ String str = "abedcba"; Turn tur=new Turn(); String turnstr=tur.Turnto(str); tur.sur(str, turnstr); }}