Binary encoding of numbers sample.

Equivalent to Python's struct.pack and struct.unpack