package suanfa.string;
/**
判断字符串是否是回文字符串
/
public class Judge {public static void main(String[] args) {
String str = "1"; System.out.println(judge(str));
}
/**
双指针
@param str
@return
/
public static Boolean judge(String str) {int left = 0;
int right = str.length() - 1;while (left <= right) {
if (str.charAt(left) != str.charAt(right)) { return Boolean.FALSE; } else { return Boolean.TRUE; }
}
return Boolean.FALSE;
}
}