题解 | #判断回文#
判断回文
http://www.nowcoder.com/practice/e297fdd8e9f543059b0b5f05f3a7f3b2
public boolean judge (String str) {
//1.判断是否是回文
if(str == null || str.length() == 0){
return false;
}
//int i = 0,j=str.length()-1;
for(int i = 0; i < str.length()/2; i++){
if(str.charAt(i) != str.charAt(str.length() - i -1)){
return false;
}
}
return true;
}