There are no leading zeroes in the returned String
from Integer.toBinaryString
. There are 16 1
s in 0xFFFF
, but there are 16 0
s too.
00000000 00000000 11111111 11111111 // 16 printed
Then the left shift by 1 made a zero significant.
00000000 00000001 11111111 11111110 // 17 printed
This value is converted to a string of ASCII digits in binary (base 2) with no extra leading 0s.