0
how to use byte to show msg in c# (CS)
input string 1. 11111111 2. 11010111 3. 00000000 (vice versa) output 1. issue 1, issue 2, issue 3, issue 4, issue5, issue6, issue7, issue8 2. issue 1, issue 2, issue 4, issue 6, issue 7, issue 8 3. I thought I should do it as below, but I don't know what is the next. Please help. public bool IsBitSetTo1( int value, int position) { return (value & (1 << position)) != 0; }
2 odpowiedzi
+ 3
// this can be do in this way:
int value = 0x10110100;
int checkBit = 0x00010000;
bool hasBit = (value & checkBit) == checkBit;
+ 3
It says in the Description:
"Input string: ..."
If as it says, input were string, then there should be no need for bit operation here, except it was a typo of course ...