根据性质来判断就好了

 public boolean judge (String str) {
        // write code here
        boolean res=true;
        if(str==null || str.length()==0){
            res=false;
        }else{
            char [] chars=str.toCharArray();
            int left=0;
            int right=chars.length-1;
            while(left<=right){
                if(chars[left]!=chars[right]){
                    res=false;
                    break;
                }
                left++;
                right--;
            }
        }
        return res;
    }