public static String check ( String str ) {
  int zero = 0 ;
  int one = 0 ;
  for ( int i = 0 ;
  i < str . length ( ) ;
  i ++ ) {
    if ( str . charAt ( i ) == '0' ) zero ++ ;
    else one ++ ;
  }
  if ( one == 0 || zero == 0 ) return str ;
  StringBuilder r = new StringBuilder ( "" ) ;
  for ( int i = 0 ;
  i < str . length ( ) * 2 ;
  i ++ ) {
    if ( i % 2 == 0 ) r . append ( '0' ) ;
    else r . append ( '1' ) ;
  }
  return r . toString ( ) ;
}

public static String check ( String str ) { int zero = 0 ; int one = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == '0' ) zero ++ ; else one ++ ; } if ( one == 0 || zero == 0 ) return str ; StringBuilder r = new StringBuilder ( " " ) ; for ( int i = 0 ; i < str . length ( ) * 2 ; i ++ ) { if ( i % 2 == 0 ) r . append ( '0' ) ; else r . append ( '1' ) ; } return r . toString ( ) ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) 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: (character_literal))) consequence: (expression_statement (update_expression (identifier))) alternative: (expression_statement (update_expression (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (return_statement (identifier))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (string_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: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (character_literal)))) alternative: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (character_literal))))))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))