-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Homework 3 completed #156
base: master
Are you sure you want to change the base?
Homework 3 completed #156
Conversation
} | ||
|
||
for (int i = 0; value > 0; i++) { | ||
binaryResult.append(((value % 2) == 0 ? "0" : "1")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need ternary operator here?
what's gonna happen if we just remove it?
return "0"; | ||
} | ||
|
||
for (int i = 0; value > 0; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this loop doesn't make a lot of sense, let's use while loop
@@ -7,6 +7,17 @@ | |||
* а возвращает String с представлением этого числа в двоичном виде. | |||
*/ | |||
public String toBinaryString(int value) { | |||
return null; | |||
StringBuilder binaryResult = new StringBuilder(); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove this empty line, it's redundant
if (value == 0) { | ||
return "0"; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
No description provided.