62,623
社区成员
发帖
与我相关
我的任务
分享
public static String rererse(String s)
{
char[] ch=s.toCharArray();
int low=0;
int high=s.length()-1;
char t;
while(low <high){
t=ch[low];
ch[low]=ch[high];
ch[high]=t;
low++;
high--;
}//while
return String.valueOf(ch);
}
public static boolean isPalindrome(String s)
{
int i=0,j=s.length()-1;
while(i<j)
{
if(s.charAt(i)!=s.charAt(j))
{
return false;
}
i++;j--;
}
return true;
}