static int NthArmstrong ( int n ) {
  int count = 0 ;
  for ( int i = 1 ;
  i <= Integer . MAX_VALUE ;
  i ++ ) {
    int num = i , rem , digit = 0 , sum = 0 ;
    num = i ;
    digit = ( int ) Math . log10 ( num ) + 1 ;
    while ( num > 0 ) {
      rem = num % 10 ;
      sum = sum + ( int ) Math . pow ( rem , digit ) ;
      num = num / 10 ;
    }
    if ( i == sum ) count ++ ;
    if ( count == n ) return i ;
  }
  return n ;
}

static int NthArmstrong ( int n ) { int count = 0 ; for ( int i = 1 ; i <= Integer . MAX_VALUE ; i ++ ) { int num = i , rem , digit = 0 , sum = 0 ; num = i ; digit = ( int ) Math . log10 ( num ) + 1 ; while ( num > 0 ) { rem = num % 10 ; sum = sum + ( int ) Math . pow ( rem , digit ) ; num = num / 10 ; } if ( i == sum ) count ++ ; if ( count == n ) return i ; } return n ; }
(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: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) right: (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: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (update_expression (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (return_statement (identifier))))) (return_statement (identifier))))