private static boolean isPossible ( int n , int [ ] counter ) {
  if ( n % 2 == 0 ) {
    for ( int i = 1 ;
    i < n ;
    i += 2 ) {
      if ( counter [ i ] != 2 ) {
        return false ;
      }
    }
    for ( int i = 0 ;
    i < n ;
    i += 2 ) {
      if ( counter [ i ] != 0 ) {
        return false ;
      }
    }
    return true ;
  }
  else {
    if ( counter [ 0 ] != 1 ) {
      return false ;
    }
    for ( int i = 1 ;
    i < n ;
    i += 2 ) {
      if ( counter [ i ] != 0 ) {
        return false ;
      }
    }
    for ( int i = 2 ;
    i < n ;
    i += 2 ) {
      if ( counter [ i ] != 2 ) {
        return false ;
      }
    }
    return true ;
  }
}

private static boolean isPossible ( int n , int [ ] counter ) { if ( n % 2 == 0 ) { for ( int i = 1 ; i < n ; i += 2 ) { if ( counter [ i ] != 2 ) { return false ; } } for ( int i = 0 ; i < n ; i += 2 ) { if ( counter [ i ] != 0 ) { return false ; } } return true ; } else { if ( counter [ 0 ] != 1 ) { return false ; } for ( int i = 1 ; i < n ; i += 2 ) { if ( counter [ i ] != 0 ) { return false ; } } for ( int i = 2 ; i < n ; i += 2 ) { if ( counter [ i ] != 2 ) { return false ; } } return true ; } }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (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: (assignment_expression left: (identifier) right: (decimal_integer_literal)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (return_statement (false)))))) (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: (assignment_expression left: (identifier) right: (decimal_integer_literal)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (return_statement (false)))))) (return_statement (true))) alternative: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (return_statement (false)))) (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: (assignment_expression left: (identifier) right: (decimal_integer_literal)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (return_statement (false)))))) (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: (assignment_expression left: (identifier) right: (decimal_integer_literal)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (return_statement (false)))))) (return_statement (true))))))