The fastest way to convert integer into binary byte array and vice versa
807606Mar 5 2007 — edited Mar 5 2007Hi,
I know there are quite a few similar questions which have been posted here, and I know how to do this in a naive way based on the conversion between decimal and binary numbers, but I wonder what is the most optimal (mainly in terms of speed) way to do it.
To reiterate, say if I have an integer i, and I want to convert i into a byte array full of 0s and 1s, and vice versa.
Many thanks.