Options

Java Bitwise Operators

sir_creamy_sir_creamy_ Inactive Imported Users Posts: 298
Hey guys,

How would I flip a single bit using Java bitwise operators?

So if I have -4 represented as a twos complement integer (i.e., 1111 1111 1111 1111 1111 1111 1111 1100) and I want to change a specific bit, how would I do that?

The operators work on all bits of an int, correct?



EDIT: My apologies for posting this in the wrong forum. Thought I was in "Off-topic"
Bachelor of Computer Science

[Forum moderators are my friends]

Comments

Sign In or Register to comment.