Top "Bits" questions

A bit is a single binary digit.

How many values can be represented with n bits?

For example, if n=9, then how many different values can be represented in 9 binary digits (bits)? My thinking is that …

binary bits
Convert bytes to bits in python

I am working with Python3.2. I need to take a hex stream as an input and parse it at bit-level. …

python hex byte bits
Bit length of a positive integer in Python

1 = 0b1 -> 1 5 = 0b101 -> 3 10 = 0b1010 -> 4 100 = 0b1100100 -> 7 1000 = 0b1111101000 -> 10 … How can I get the …

python bits bitcount
Using Python How can I read the bits in a byte?

I have a file where the first byte contains encoded information. In Matlab I can read the byte bit by …

python byte bits
Grabbing n bits from a byte

I'm having a little trouble grabbing n bits from a byte. I have an unsigned integer. Let's say our number …

c++ c binary hex bits
Non-restoring division algorithm

Does anyone know the steps for dividing unsigned binary integers using non-restoring division? It's hard to find any good sources …

algorithm binary division bits addition
how to do two complement multiplication and division of integers?

I have read this post on binary multiplication using two complement. but it is not very clear to me. Even …

binary division multiplication bits twos-complement
Generate all binary strings of length n with k bits set

What's the best algorithm to find all binary strings of length n that contain k bits set? For example, if …

algorithm binary permutation combinations bits
Byte to Binary String C# - Display all 8 digits

I want to display one byte in textbox. Now I'm using: Convert.ToString(MyVeryOwnByte, 2); But when byte is has 0's …

c# .net string byte bits
What are the INFINITY constants in Java, really?

I just recently ran across the constants in the primitive type wrapper classes like Double.POSITIVE_INFINITY and Double.NEGATIVE_…

java constants bits infinity