static void rotate ( int N ) {
  if ( N == 0 ) return ;
  Node current = head ;
  int count = 1 ;
  while ( count < N && current != null ) {
    current = current . next ;
    count ++ ;
  }
  if ( current == null ) return ;
  Node NthNode = current ;
  while ( current . next != null ) current = current . next ;
  current . next = head ;
  ( head ) . prev = current ;
  head = NthNode . next ;
  ( head ) . prev = null ;
  NthNode . next = null ;
}

static void rotate ( int N ) { if ( N == 0 ) return ; Node current = head ; int count = 1 ; while ( count < N && current != null ) { current = current . next ; count ++ ; } if ( current == null ) return ; Node NthNode = current ; while ( current . next != null ) current = current . next ; current . next = head ; ( head ) . prev = current ; head = NthNode . next ; ( head ) . prev = null ; NthNode . next = null ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement)) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (null_literal)))) body: (block (expression_statement (assignment_expression left: (identifier) right: (field_access object: (identifier) field: (identifier)))) (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) consequence: (return_statement)) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (null_literal))) body: (expression_statement (assignment_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))))) (expression_statement (assignment_expression left: (field_access object: (identifier) field: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (field_access object: (parenthesized_expression (identifier)) field: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (field_access object: (identifier) field: (identifier)))) (expression_statement (assignment_expression left: (field_access object: (parenthesized_expression (identifier)) field: (identifier)) right: (null_literal))) (expression_statement (assignment_expression left: (field_access object: (identifier) field: (identifier)) right: (null_literal)))))