compare each character from starting with its corresponding character from last
for ( int i = 0 ; i < len / 2 ; i ++ ) if ( str . charAt ( i ) != str . charAt ( len - i - 1 ) ) return false ; return true ; }