java判断是否是回文字符
public class PalindromeTest { public static void main(String[] args) { isPalidrome("abcdedcba") ; } public static void isPalidrome(String str){ char[] ch = str.toCharArray(); int len = ch.length; for (int i = 0, int j = len - 1; i <= j;) { if (ch[i++] == ch[j--]) { } else { System.out.println("this string is not palindrome!"); break; } } }}
?