private static char [ ] [ ] shiftCharMatrix ( char [ ] [ ] matrix , int H , int W ) {
  int SIZE_H = matrix . length ;
  int SIZE_W = matrix [ 0 ] . length ;
  char [ ] [ ] shiftedMatrix = new char [ SIZE_H ] [ SIZE_W ] ;
  for ( int h = 0 ;
  h < SIZE_H ;
  h ++ ) {
    for ( int w = 0 ;
    w < SIZE_W ;
    w ++ ) {
      int next_h = ( h + H ) % SIZE_H ;
      int next_w = ( w + W ) % SIZE_W ;
      shiftedMatrix [ next_h ] [ next_w ] = matrix [ h ] [ w ] ;
    }
  }
  return shiftedMatrix ;
}

private static char [ ] [ ] shiftCharMatrix ( char [ ] [ ] matrix , int H , int W ) { int SIZE_H = matrix . length ; int SIZE_W = matrix [ 0 ] . length ; char [ ] [ ] shiftedMatrix = new char [ SIZE_H ] [ SIZE_W ] ; for ( int h = 0 ; h < SIZE_H ; h ++ ) { for ( int w = 0 ; w < SIZE_W ; w ++ ) { int next_h = ( h + H ) % SIZE_H ; int next_w = ( w + W ) % SIZE_W ; shiftedMatrix [ next_h ] [ next_w ] = matrix [ h ] [ w ] ; } } return shiftedMatrix ; }
(method_declaration (modifiers) type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (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: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (array_access array: (identifier) index: (decimal_integer_literal)) field: (identifier)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier)) dimensions: (dimensions_expr (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 (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 (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))))))) (return_statement (identifier))))