static int largestNum ( int num ) {
  int max_digit = - 1 ;
  int max_digit_indx = - 1 ;
  int l_indx = - 1 ;
  int r_indx = 1 ;
  String num_in_str = String . valueOf ( num ) ;
  for ( int i = num_in_str . length ( ) - 1 ;
  i >= 0 ;
  i -- ) {
    if ( num_in_str . charAt ( r_indx ) > max_digit ) {
      max_digit = num_in_str . charAt ( i ) ;
      max_digit_indx = i ;
      continue ;
    }
    if ( num_in_str . charAt ( i ) < max_digit ) {
      l_indx = i ;
      r_indx = max_digit_indx ;
    }
  }
  if ( l_indx == - 1 ) return num ;
  num_in_str = swap ( num_in_str , l_indx , r_indx ) ;
  return Integer . parseInt ( num_in_str ) ;
}

static int largestNum ( int num ) { int max_digit = - 1 ; int max_digit_indx = - 1 ; int l_indx = - 1 ; int r_indx = 1 ; String num_in_str = String . valueOf ( num ) ; for ( int i = num_in_str . length ( ) - 1 ; i >= 0 ; i -- ) { if ( num_in_str . charAt ( r_indx ) > max_digit ) { max_digit = num_in_str . charAt ( i ) ; max_digit_indx = i ; continue ; } if ( num_in_str . charAt ( i ) < max_digit ) { l_indx = i ; r_indx = max_digit_indx ; } } if ( l_indx == - 1 ) return num ; num_in_str = swap ( num_in_str , l_indx , r_indx ) ; return Integer . parseInt ( num_in_str ) ; }
(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: (unary_expression operand: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (continue_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (unary_expression operand: (decimal_integer_literal)))) consequence: (return_statement (identifier))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier))))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))