static String previousNumber ( String num ) {
  int n = num . length ( ) ;
  if ( num . compareTo ( "1" ) == 0 ) {
    return "0" ;
  }
  int i ;
  for ( i = n - 1 ;
  i >= 0 ;
  i -- ) {
    if ( num . charAt ( i ) == '1' ) {
      num = num . substring ( 0 , i ) + '0' + num . substring ( i + 1 ) ;
      break ;
    }
    else {
      num = num . substring ( 0 , i ) + '1' + num . substring ( i + 1 ) ;
    }
  }
  if ( i == 0 ) {
    return num . substring ( 1 , n - 1 ) ;
  }
  return num ;
}

static String previousNumber ( String num ) { int n = num . length ( ) ; if ( num . compareTo ( "1" ) == 0 ) { return "0" ; } int i ; for ( i = n - 1 ; i >= 0 ; i -- ) { if ( num . charAt ( i ) == '1' ) { num = num . substring ( 0 , i ) + '0' + num . substring ( i + 1 ) ; break ; } else { num = num . substring ( 0 , i ) + '1' + num . substring ( i + 1 ) ; } } if ( i == 0 ) { return num . substring ( 1 , n - 1 ) ; } return num ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))) right: (decimal_integer_literal))) consequence: (block (return_statement (string_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier))) (for_statement init: (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) right: (character_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (break_statement)) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) right: (character_literal)) right: (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: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (return_statement (identifier))))