static int sumOfNodes ( Node head ) {
  Node ptr = head ;
  int sum = 0 ;
  while ( ptr != null ) {
    sum += ptr . data ;
    ptr = ptr . next ;
  }
  return sum ;
}

static int sumOfNodes ( Node head ) { Node ptr = head ; int sum = 0 ; while ( ptr != null ) { sum += ptr . data ; ptr = ptr . next ; } 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))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) 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)))))) (return_statement (identifier))))