72 532
Assignments Done
Successfully Done
In April 2019

Answer to Question #40180 in Java | JSP | JSF for LostWind

Question #40180
Write a recursive method that converts a decimal integer to a binary string.
Expert's answer
public class IntegerToStringBinary {

public static void main(String argv[]){
int num = 105; //enter your integer number here

public static String convertToBinary(int number)
if(number > 0)
String str1 = new String(convertToBinary(number / 2));
String str2 = new String(str1+Integer.toString(number % 2));
return str2;

return "0";

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions