static int isPowerOf2 ( String s ) {
  char [ ] str = s . toCharArray ( ) ;
  int len_str = s . length ( ) ;
  int num = 0 ;
  if ( len_str == 1 && str [ len_str - 1 ] == '1' ) return 0 ;
  while ( len_str != 1 || str [ len_str - 1 ] != '1' ) {
    if ( ( str [ len_str - 1 ] - '0' ) % 2 == 1 ) return 0 ;
    int j = 0 ;
    for ( int i = 0 ;
    i < len_str ;
    i ++ ) {
      num = num * 10 + ( int ) str [ i ] - ( int ) '0' ;
      if ( num < 2 ) {
        if ( i != 0 ) str [ j ++ ] = '0' ;
        continue ;
      }
      str [ j ++ ] = ( char ) ( ( int ) ( num / 2 ) + ( int ) '0' ) ;
      num = ( num ) - ( num / 2 ) * 2 ;
    }
    str [ j ] = '\0' ;
    len_str = j ;
  }
  return 1 ;
}

static int isPowerOf2 ( String s ) { char [ ] str = s . toCharArray ( ) ; int len_str = s . length ( ) ; int num = 0 ; if ( len_str == 1 && str [ len_str - 1 ] == '1' ) return 0 ; while ( len_str != 1 || str [ len_str - 1 ] != '1' ) { if ( ( str [ len_str - 1 ] - '0' ) % 2 == 1 ) return 0 ; int j = 0 ; for ( int i = 0 ; i < len_str ; i ++ ) { num = num * 10 + ( int ) str [ i ] - ( int ) '0' ; if ( num < 2 ) { if ( i != 0 ) str [ j ++ ] = '0' ; continue ; } str [ j ++ ] = ( char ) ( ( int ) ( num / 2 ) + ( int ) '0' ) ; num = ( num ) - ( num / 2 ) * 2 ; } str [ j ] = ' \0' ; len_str = j ; } return 1 ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal)))) consequence: (return_statement (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal)))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (return_statement (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: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (cast_expression type: (integral_type) value: (array_access array: (identifier) index: (identifier)))) right: (cast_expression type: (integral_type) value: (character_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (update_expression (identifier))) right: (character_literal)))) (continue_statement))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (update_expression (identifier))) right: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (cast_expression type: (integral_type) value: (character_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (cast_expression type: (type_identifier) value: (unary_expression operand: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (return_statement (decimal_integer_literal))))