static void printKMax ( int a [ ] , int n , int k ) {
  if ( k == 1 ) {
    for ( int i = 0 ;
    i < n ;
    i += 1 ) System . out . print ( a [ i ] + " " ) ;
    return ;
  }
  int p = 0 , q = k - 1 , t = p , max = a [ k - 1 ] ;
  while ( q <= n - 1 ) {
    if ( a [ p ] > max ) max = a [ p ] ;
    p += 1 ;
    if ( q == p && p != n ) {
      System . out . print ( max + " " ) ;
      q ++ ;
      p = ++ t ;
      if ( q < n ) max = a [ q ] ;
    }
  }
}

static void printKMax ( int a [ ] , int n , int k ) { if ( k == 1 ) { for ( int i = 0 ; i < n ; i += 1 ) System . out . print ( a [ i ] + " ▁ " ) ; return ; } int p = 0 , q = k - 1 , t = p , max = a [ k - 1 ] ; while ( q <= n - 1 ) { if ( a [ p ] > max ) max = a [ p ] ; p += 1 ; if ( q == p && p != n ) { System . out . print ( max + " ▁ " ) ; q ++ ; p = ++ t ; if ( q < n ) max = a [ q ] ; } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (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: (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: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (string_literal)))))) (return_statement))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal))) declarator: (variable_declarator name: (identifier) value: (identifier)) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal))))) (expression_statement (update_expression (identifier))) (expression_statement (assignment_expression left: (identifier) right: (update_expression (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))))))))))