0

I have a set of binary numbers (originally was hex's) that I want to find the index of 1 in it. These sets are :

1000, index = 3
0100, index = 2
0010, index = 1
0001, index = 0

I can't wrap my head around it, I tried getting the decimal representation and do some math magic with it to turn it into 0, 1, 2, 3 but no clue.

Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
Rafael Adel
  • 7,673
  • 25
  • 77
  • 118

0 Answers0