private static int samTransitionsMinusMaxTransitions ( int n ) {
  int samTrans = 0 ;
  int maxTrans = 0 ;
  long segmentState = 0 ;
  while ( true ) {
    long newState = numberToSegments ( n ) ;
    if ( newState == segmentState ) break ;
    maxTrans += Long . bitCount ( newState ^ segmentState ) ;
    segmentState = newState ;
    samTrans += 2 * Long . bitCount ( newState ) ;
    n = digitSum ( n ) ;
  }
  maxTrans += Long . bitCount ( segmentState ) ;
  return samTrans - maxTrans ;
}

private static int samTransitionsMinusMaxTransitions ( int n ) { int samTrans = 0 ; int maxTrans = 0 ; long segmentState = 0 ; while ( true ) { long newState = numberToSegments ( n ) ; if ( newState == segmentState ) break ; maxTrans += Long . bitCount ( newState ^ segmentState ) ; segmentState = newState ; samTrans += 2 * Long . bitCount ( newState ) ; n = digitSum ( n ) ; } maxTrans += Long . bitCount ( segmentState ) ; return samTrans - maxTrans ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (true)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (break_statement)) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier))))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (return_statement (binary_expression left: (identifier) right: (identifier)))))