private static int digitSum ( BigInteger x ) {
  if ( x . signum ( ) < 1 ) throw new IllegalArgumentException ( "Only for positive integers" ) ;
  int sum = 0 ;
  for ( char c : x . toString ( ) . toCharArray ( ) ) sum += c - '0' ;
  return sum ;
}

private static int digitSum ( BigInteger x ) { if ( x . signum ( ) < 1 ) throw new IllegalArgumentException ( " Only ▁ for ▁ positive ▁ integers " ) ; int sum = 0 ; for ( char c : x . toString ( ) . toCharArray ( ) ) sum += c - '0' ; return sum ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (throw_statement (object_creation_expression type: (type_identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)) body: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (character_literal))))) (return_statement (identifier))))