Skip to content
Open

Hw2.1 #108

Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main/java/core/basesyntax/FlipBit.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ public class FlipBit {
* Договоримся, что биты нумеруются от младшего (индекс 1) к старшему (индекс 32).</p>
*/
public int flipBit(int value, int bitIndex) {
return 0;
if (bitIndex == 1) {
return value ^ 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.

shift on (1 -1 = 0) would make any difference?

} else {
return value ^ (1 << bitIndex - 1);
}
}
}