static int sumOfList ( Node head ) {
  Node temp = head ;
  int sum = 0 ;
  if ( head != null ) {
    do {
      temp = temp . next ;
      sum += temp . data ;
    }
    while ( temp != head ) ;
  }
  return sum ;
}

static int sumOfList ( Node head ) { Node temp = head ; int sum = 0 ; if ( head != null ) { do { temp = temp . next ; sum += temp . data ; } while ( temp != head ) ; } return sum ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (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))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) consequence: (block (do_statement body: (block (expression_statement (assignment_expression left: (identifier) right: (field_access object: (identifier) field: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))))) condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))))) (return_statement (identifier))))