I have a long variable in java and convert it to a binary string like
long var = 24; Long.toBinaryString (shaft);
Now it prints only 7 bits, but I need to display all 64 bits, i.e. all leading zeros, how can I achieve this?
The reason is because I need to iterate over each bit and perform the operation according to the status, is there a better way to do this?
Vivek source
share