private static void permuteHelper ( char [ ] arr , int index ) {
  if ( index >= arr . length - 1 ) {
    set . add ( new String ( arr ) ) ;
    return ;
  }
  for ( int i = index ;
  i < arr . length ;
  i ++ ) {
    char t = arr [ index ] ;
    arr [ index ] = arr [ i ] ;
    arr [ i ] = t ;
    permuteHelper ( arr , index + 1 ) ;
    t = arr [ index ] ;
    arr [ index ] = arr [ i ] ;
    arr [ i ] = t ;
  }
}

private static void permuteHelper ( char [ ] arr , int index ) { if ( index >= arr . length - 1 ) { set . add ( new String ( arr ) ) ; return ; } for ( int i = index ; i < arr . length ; i ++ ) { char t = arr [ index ] ; arr [ index ] = arr [ i ] ; arr [ i ] = t ; permuteHelper ( arr , index + 1 ) ; t = arr [ index ] ; arr [ index ] = arr [ i ] ; arr [ i ] = t ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier)))))) (return_statement))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) 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: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))))))