static int larrgestPalindrome ( int n ) {
  int upper_limit = 0 ;
  for ( int i = 1 ;
  i <= n ;
  i ++ ) {
    upper_limit *= 10 ;
    upper_limit += 9 ;
  }
  int lower_limit = 1 + upper_limit / 10 ;
  int max_product = 0 ;
  for ( int i = upper_limit ;
  i >= lower_limit ;
  i -- ) {
    for ( int j = i ;
    j >= lower_limit ;
    j -- ) {
      int product = i * j ;
      if ( product < max_product ) break ;
      int number = product ;
      int reverse = 0 ;
      while ( number != 0 ) {
        reverse = reverse * 10 + number % 10 ;
        number /= 10 ;
      }
      if ( product == reverse && product > max_product ) max_product = product ;
    }
  }
  return max_product ;
}

static int larrgestPalindrome ( int n ) { int upper_limit = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { upper_limit *= 10 ; upper_limit += 9 ; } int lower_limit = 1 + upper_limit / 10 ; int max_product = 0 ; for ( int i = upper_limit ; i >= lower_limit ; i -- ) { for ( int j = i ; j >= lower_limit ; j -- ) { int product = i * j ; if ( product < max_product ) break ; int number = product ; int reverse = 0 ; while ( number != 0 ) { reverse = reverse * 10 + number % 10 ; number /= 10 ; } if ( product == reverse && product > max_product ) max_product = product ; } } return max_product ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (decimal_integer_literal) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (break_statement)) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier)))))))) (return_statement (identifier))))