How can we convert an 8bit binary to an array and find the index of high(1 s) in that binary ?
varunme 0 Newbie Poster
Recommended Answers
Jump to PostHi, varunne, welcome at Daniweb :)
This snippet may give you an idea.
Jump to PostLet me know if this Linq needs any clarification:
//To generate the bool array bool[] myBits = (from bit in Convert.ToString(myByte, 2).PadLeft(8, '0') select bit == '1') .ToArray<bool>(); //To display myBits.ToList().ForEach(y => Console.Write(y ? "1" : "0"));
All 8 Replies
ddanbe 2,724 Professional Procrastinator Featured Poster
skatamatic 371 Practically a Posting Shark
varunme 0 Newbie Poster
skatamatic 371 Practically a Posting Shark
varunme 0 Newbie Poster
Momerath 1,327 Nearly a Senior Poster Featured Poster
varunme 0 Newbie Poster
ddanbe 2,724 Professional Procrastinator Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.