Skip to content

Homework 3 completed#156

Open
Borisko130 wants to merge 3 commits into
mate-academy:masterfrom
Borisko130:homework3
Open

Homework 3 completed#156
Borisko130 wants to merge 3 commits into
mate-academy:masterfrom
Borisko130:homework3

Conversation

@Borisko130

Copy link
Copy Markdown

No description provided.

}

for (int i = 0; value > 0; i++) {
binaryResult.append(((value % 2) == 0 ? "0" : "1"));

Copy link
Copy Markdown

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++) {

Copy link
Copy Markdown

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

public String toBinaryString(int value) {
return null;
StringBuilder binaryResult = new StringBuilder();

Copy link
Copy Markdown

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";
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants