private static int solve ( int include , int i ) {
  if ( i == n ) {
    int res = 0 ;
    for ( int j = 0 ;
    j < n ;
    j ++ ) {
      if ( include % 2 == 1 ) res ++ ;
      include /= 2 ;
    }
    return res ;
  }
  boolean flag = true ;
  int tmp = include ;
  for ( int j = 0 ;
  j < i ;
  j ++ ) {
    if ( tmp % 2 == 1 && ! a [ j ] [ i ] ) {
      flag = false ;
      break ;
    }
    tmp /= 2 ;
  }
  if ( flag ) {
    return Math . max ( solve ( include + ( int ) Math . pow ( 2 , i ) , i + 1 ) , solve ( include , i + 1 ) ) ;
  }
  else {
    return solve ( include , i + 1 ) ;
  }
}

private static int solve ( int include , int i ) { if ( i == n ) { int res = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( include % 2 == 1 ) res ++ ; include /= 2 ; } return res ; } boolean flag = true ; int tmp = include ; for ( int j = 0 ; j < i ; j ++ ) { if ( tmp % 2 == 1 && ! a [ j ] [ i ] ) { flag = false ; break ; } tmp /= 2 ; } if ( flag ) { return Math . max ( solve ( include + ( int ) Math . pow ( 2 , i ) , i + 1 ) , solve ( include , i + 1 ) ) ; } else { return solve ( include , i + 1 ) ; } }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (return_statement (identifier)))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) right: (unary_expression operand: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (break_statement))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))))) (binary_expression left: (identifier) right: (decimal_integer_literal)))) (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)))))))) alternative: (block (return_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)))))))))