If a byte is 192 or any other value, is there a way to show how it is made up of its individual bit values?
If a byte is 192 or any other value, is there a way to show how it is made up of its individual bit values? For example, If a byte is 192, I know this will be 128 + 64 = 192 Is there a way in CSharp to list the values that make up the byte so they can be printed or used elsewhere? Thanks "Yes, that's possible" and "What code has been tried / how is it not working?" There are plenty of questions/answers already on the topic.. – user2864740 Jun 29 at 7:10 2 Answers 2 Sample code: int V = 192; int B = 1; for (int i=0; i<8; i++) { if (V&0x01 == 1) { // Use B any way you like } V/=2; B*=2; } Try following : static string ToBinary(int input) { string binary = ...
