This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Recursive Method to Convert Decimal Number into a Binary Number  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please help me to Write a recursive method to convert a decimal number into a binary number, Printing the Binary number?
And Also please tell me about Recursive methods
 
Marshal
Posts: 64115
215
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

A recursive method is one which calls itself. If you use recursion, you make each call slightly smaller than its predecessor, and you must eventually reach a call so small that the recursion stops. That latter is called the base case.
Please show us the algorithm/formula you have been given to convert a decimal number to binary.
 
Saloon Keeper
Posts: 20643
122
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The entry in Stan Kelley-Bootle's "The Devil's DP Dictionary for "recursion" reads as follows:

dictionary entry wrote:
recursion

See recursion

 
Nadun Fernando
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I'm learning java and i don't know how to write a recursive method, so i have no code written. Could you please give me a code using recursive methods to convert Decimal to Binary
 
Campbell Ritchie
Marshal
Posts: 64115
215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Nadun Fernando wrote:. . . Could you please give me a code using recursive methods to convert Decimal to Binary

No. We don't work like that. We expect you to try something first.
 
Campbell Ritchie
Marshal
Posts: 64115
215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:. . . The Devil's DP Dictionary for "recursion" . . .

Hahahahahahahaha!
 
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!