static long nextPrimePalindrome ( long N ) {
  for ( long k = 1 ;
  k < 1000000l ;
  k ++ ) {
    String s = "" + k ;
    String z ;
    z = reverse ( s ) ;
    long x = Long . parseLong ( s + z . substring ( 1 , z . length ( ) ) ) ;
    if ( x >= N && isPrime ( x ) ) return x ;
    s = "" + ( k ) ;
    z = s ;
    z = reverse ( z ) ;
    x = Long . parseLong ( s + z ) ;
    if ( x >= N && isPrime ( x ) ) return x ;
  }
  return - 1 ;
}

static long nextPrimePalindrome ( long N ) { for ( long k = 1 ; k < 1000000l ; k ++ ) { String s = " " + k ; String z ; z = reverse ( s ) ; long x = Long . parseLong ( s + z . substring ( 1 , z . length ( ) ) ) ; if ( x >= N && isPrime ( x ) ) return x ; s = " " + ( k ) ; z = s ; z = reverse ( z ) ; x = Long . parseLong ( s + z ) ; if ( x >= N && isPrime ( x ) ) return x ; } return - 1 ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (string_literal) right: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) consequence: (return_statement (identifier))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (string_literal) right: (parenthesized_expression (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) consequence: (return_statement (identifier))))) (return_statement (unary_expression operand: (decimal_integer_literal)))))