static int possiblePalinByRemovingOneChar ( String str ) {
  int low = 0 , high = str . length ( ) - 1 ;
  while ( low < high ) {
    if ( str . charAt ( low ) == str . charAt ( high ) ) {
      low ++ ;
      high -- ;
    }
    else {
      if ( isPalindrome ( str , low + 1 , high ) ) return low ;
      if ( isPalindrome ( str , low , high - 1 ) ) return high ;
      return - 1 ;
    }
  }
  return - 2 ;
}

static int possiblePalinByRemovingOneChar ( String str ) { int low = 0 , high = str . length ( ) - 1 ; while ( low < high ) { if ( str . charAt ( low ) == str . charAt ( high ) ) { low ++ ; high -- ; } else { if ( isPalindrome ( str , low + 1 , high ) ) return low ; if ( isPalindrome ( str , low , high - 1 ) ) return high ; return - 1 ; } } return - 2 ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (block (expression_statement (update_expression (identifier))) (expression_statement (update_expression (identifier)))) alternative: (block (if_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier)))) consequence: (return_statement (identifier))) (if_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (return_statement (identifier))) (return_statement (unary_expression operand: (decimal_integer_literal))))))) (return_statement (unary_expression operand: (decimal_integer_literal)))))