static int flipBit ( int a ) {
  if ( ~ a == 0 ) {
    return 8 * sizeof ( ) ;
  }
  int currLen = 0 , prevLen = 0 , maxLen = 0 ;
  while ( a != 0 ) {
    if ( ( a & 1 ) == 1 ) {
      currLen ++ ;
    }
    else if ( ( a & 1 ) == 0 ) {
      prevLen = ( a & 2 ) == 0 ? 0 : currLen ;
      currLen = 0 ;
    }
    maxLen = Math . max ( prevLen + currLen , maxLen ) ;
    a >>= 1 ;
  }
  return maxLen + 1 ;
}

static int flipBit ( int a ) { if ( ~ a == 0 ) { return 8 * sizeof ( ) ; } int currLen = 0 , prevLen = 0 , maxLen = 0 ; while ( a != 0 ) { if ( ( a & 1 ) == 1 ) { currLen ++ ; } else if ( ( a & 1 ) == 0 ) { prevLen = ( a & 2 ) == 0 ? 0 : currLen ; currLen = 0 ; } maxLen = Math . max ( prevLen + currLen , maxLen ) ; a >>= 1 ; } return maxLen + 1 ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (unary_expression operand: (identifier)) right: (decimal_integer_literal))) consequence: (block (return_statement (binary_expression left: (decimal_integer_literal) right: (method_invocation name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))) consequence: (block (expression_statement (update_expression (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (ternary_expression condition: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (return_statement (binary_expression left: (identifier) right: (decimal_integer_literal)))))