0

[Solved] Why doesn’t this work?

I’ve worked on this for an hour. Hoping for an answer. —— Update: Still has some problems. —— Update: Solved. https://code.sololearn.com/cqJ9oJvCjR6Q/?ref=app

31st Jan 2022, 5:10 PM
Albert Tan
2 Answers
+ 6
Albert Tan What is the use of setInt and main method in Converter class? Doesn't make sense if there is toBinary method. And what is the use of dec parameter in toBinary method? This is enough: public static String toBinary(int num) { String binary = ""; while (num > 0) { binary = (num % 2) + binary; num /= 2; } return binary; }
31st Jan 2022, 5:59 PM
AÍąJ
AÍąJ - avatar
+ 1
Thanks!
1st Feb 2022, 2:30 AM
Albert Tan