public static void main ( String [ ] args ) {
  Scanner scan = new Scanner ( System . in ) ;
  Integer s = scan . nextInt ( ) ;
  List < Integer > numList = new ArrayList ( ) ;
  OUT : for ( int i = 1 ;
  ;
  i ++ ) {
    if ( i == 1 ) {
      numList . add ( s ) ;
    }
    Integer currentValue = null ;
    if ( i > 1 ) {
      Integer prevValue = numList . get ( i - 2 ) ;
      if ( prevValue % 2 == 0 ) {
        currentValue = prevValue / 2 ;
      }
      else {
        currentValue = 3 * prevValue + 1 ;
      }
      for ( Integer num : numList ) {
        if ( currentValue == num ) {
          System . out . println ( i ) ;
          break OUT ;
        }
      }
      numList . add ( currentValue ) ;
    }
  }
}

public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; Integer s = scan . nextInt ( ) ; List < Integer > numList = new ArrayList ( ) ; OUT : for ( int i = 1 ; ; i ++ ) { if ( i == 1 ) { numList . add ( s ) ; } Integer currentValue = null ; if ( i > 1 ) { Integer prevValue = numList . get ( i - 2 ) ; if ( prevValue % 2 == 0 ) { currentValue = prevValue / 2 ; } else { currentValue = 3 * prevValue + 1 ; } for ( Integer num : numList ) { if ( currentValue == num ) { System . out . println ( i ) ; break OUT ; } } numList . add ( currentValue ) ; } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (labeled_statement (identifier) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (null_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (decimal_integer_literal)))))) (enhanced_for_statement type: (type_identifier) name: (identifier) value: (identifier) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (break_statement (identifier)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))))))