public static long permute ( int n ) {
  int pow = 2 ;
  while ( pow <= 10 ) {
    char [ ] ar = new char [ pow ] ;
    for ( int i = 0 ;
    i < pow / 2 ;
    i ++ ) ar [ i ] = '4' ;
    for ( int i = pow / 2 ;
    i < pow ;
    i ++ ) ar [ i ] = '7' ;
    permuteHelper ( ar , 0 ) ;
    for ( String s : set ) {
      if ( Long . parseLong ( s ) >= n ) {
        return Long . parseLong ( s ) ;
      }
    }
    pow += 2 ;
  }
  return 0 ;
}

public static long permute ( int n ) { int pow = 2 ; while ( pow <= 10 ) { char [ ] ar = new char [ pow ] ; for ( int i = 0 ; i < pow / 2 ; i ++ ) ar [ i ] = '4' ; for ( int i = pow / 2 ; i < pow ; i ++ ) ar [ i ] = '7' ; permuteHelper ( ar , 0 ) ; for ( String s : set ) { if ( Long . parseLong ( s ) >= n ) { return Long . parseLong ( s ) ; } } pow += 2 ; } return 0 ; }
(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))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal)))) (enhanced_for_statement type: (type_identifier) name: (identifier) value: (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 (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (return_statement (decimal_integer_literal))))