public static void pattern ( int n ) {
  for ( int i = 1 ;
  i <= n * 2 ;
  i ++ ) System . out . print ( " " ) ;
  System . out . print ( 0 + "\n" ) ;
  for ( int i = 1 ;
  i <= ( n * 2 ) - 1 ;
  i ++ ) {
    if ( i < n ) {
      for ( int j = 1 ;
      j <= ( n - i ) * 2 ;
      j ++ ) System . out . print ( " " ) ;
    }
    else {
      for ( int j = 1 ;
      j <= ( i % n ) * 2 ;
      j ++ ) System . out . print ( " " ) ;
    }
    if ( i < n ) {
      for ( int j = 0 ;
      j <= i % n ;
      j ++ ) System . out . print ( j + " " ) ;
      for ( int j = ( i % n ) - 1 ;
      j > 0 ;
      j -- ) System . out . print ( j + " " ) ;
      System . out . print ( 0 ) ;
    }
    else if ( i > n ) {
      for ( int j = 0 ;
      j <= n - ( i - n ) ;
      j ++ ) System . out . print ( j + " " ) ;
      for ( int j = ( n - ( i - n ) ) - 1 ;
      j > 0 ;
      j -- ) System . out . print ( j + " " ) ;
      System . out . print ( 0 ) ;
    }
    else {
      for ( int j = 0 ;
      j <= n ;
      j ++ ) System . out . print ( j + " " ) ;
      for ( int j = n - 1 ;
      j > 0 ;
      j -- ) System . out . print ( j + " " ) ;
      System . out . print ( 0 ) ;
    }
    System . out . print ( "\n" ) ;
  }
  for ( int i = 1 ;
  i <= n * 2 ;
  i ++ ) System . out . print ( " " ) ;
  System . out . print ( 0 ) ;
}

public static void pattern ( int n ) { for ( int i = 1 ; i <= n * 2 ; i ++ ) System . out . print ( " ▁ " ) ; System . out . print ( 0 + " \n " ) ; for ( int i = 1 ; i <= ( n * 2 ) - 1 ; i ++ ) { if ( i < n ) { for ( int j = 1 ; j <= ( n - i ) * 2 ; j ++ ) System . out . print ( " ▁ " ) ; } else { for ( int j = 1 ; j <= ( i % n ) * 2 ; j ++ ) System . out . print ( " ▁ " ) ; } if ( i < n ) { for ( int j = 0 ; j <= i % n ; j ++ ) System . out . print ( j + " ▁ " ) ; for ( int j = ( i % n ) - 1 ; j > 0 ; j -- ) System . out . print ( j + " ▁ " ) ; System . out . print ( 0 ) ; } else if ( i > n ) { for ( int j = 0 ; j <= n - ( i - n ) ; j ++ ) System . out . print ( j + " ▁ " ) ; for ( int j = ( n - ( i - n ) ) - 1 ; j > 0 ; j -- ) System . out . print ( j + " ▁ " ) ; System . out . print ( 0 ) ; } else { for ( int j = 0 ; j <= n ; j ++ ) System . out . print ( j + " ▁ " ) ; for ( int j = n - 1 ; j > 0 ; j -- ) System . out . print ( j + " ▁ " ) ; System . out . print ( 0 ) ; } System . out . print ( " \n " ) ; } for ( int i = 1 ; i <= n * 2 ; i ++ ) System . out . print ( " ▁ " ) ; System . out . print ( 0 ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (decimal_integer_literal) right: (string_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: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) 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: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))))) alternative: (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: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) 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: (binary_expression left: (identifier) right: (identifier))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (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 (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) 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: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))))) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (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 (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) alternative: (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: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (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 (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))