static void printEgyptian ( int nr , int dr ) {
  if ( dr == 0 || nr == 0 ) {
    return ;
  }
  if ( dr % nr == 0 ) {
    System . out . print ( "1/" + dr / nr ) ;
    return ;
  }
  if ( nr % dr == 0 ) {
    System . out . print ( nr / dr ) ;
    return ;
  }
  if ( nr > dr ) {
    System . out . print ( nr / dr + " + " ) ;
    printEgyptian ( nr % dr , dr ) ;
    return ;
  }
  int n = dr / nr + 1 ;
  System . out . print ( "1/" + n + " + " ) ;
  printEgyptian ( nr * n - dr , dr * n ) ;
}

static void printEgyptian ( int nr , int dr ) { if ( dr == 0 || nr == 0 ) { return ; } if ( dr % nr == 0 ) { System . out . print ( "1 / " + dr / nr ) ; return ; } if ( nr % dr == 0 ) { System . out . print ( nr / dr ) ; return ; } if ( nr > dr ) { System . out . print ( nr / dr + " ▁ + ▁ " ) ; printEgyptian ( nr % dr , dr ) ; return ; } int n = dr / nr + 1 ; System . out . print ( "1 / " + n + " ▁ + ▁ " ) ; printEgyptian ( nr * n - dr , dr * n ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (return_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (string_literal) right: (binary_expression left: (identifier) right: (identifier)))))) (return_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) (return_statement))) (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 (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (string_literal))))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)) (identifier)))) (return_statement))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (string_literal) right: (identifier)) right: (string_literal))))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) (binary_expression left: (identifier) right: (identifier)))))))