static int minFlipsSub ( String mat [ ] , int i , int j ) {
  int cnt0 = 0 , cnt1 = 0 ;
  if ( mat [ i ] . charAt ( j ) == '1' ) cnt1 ++ ;
  else cnt0 ++ ;
  if ( mat [ i ] . charAt ( j + 1 ) == '1' ) cnt1 ++ ;
  else cnt0 ++ ;
  if ( mat [ i + 1 ] . charAt ( j ) == '1' ) cnt1 ++ ;
  else cnt0 ++ ;
  if ( mat [ i + 1 ] . charAt ( j + 1 ) == '1' ) cnt1 ++ ;
  else cnt0 ++ ;
  return Math . min ( cnt0 , cnt1 ) ;
}

static int minFlipsSub ( String mat [ ] , int i , int j ) { int cnt0 = 0 , cnt1 = 0 ; if ( mat [ i ] . charAt ( j ) == '1' ) cnt1 ++ ; else cnt0 ++ ; if ( mat [ i ] . charAt ( j + 1 ) == '1' ) cnt1 ++ ; else cnt0 ++ ; if ( mat [ i + 1 ] . charAt ( j ) == '1' ) cnt1 ++ ; else cnt0 ++ ; if ( mat [ i + 1 ] . charAt ( j + 1 ) == '1' ) cnt1 ++ ; else cnt0 ++ ; return Math . min ( cnt0 , cnt1 ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (array_access array: (identifier) index: (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: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal))) consequence: (expression_statement (update_expression (identifier))) alternative: (expression_statement (update_expression (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) 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: (method_invocation object: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal))) consequence: (expression_statement (update_expression (identifier))) alternative: (expression_statement (update_expression (identifier)))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))