Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8429675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:24:08+00:00 2026-06-10T05:24:08+00:00

my byte array has these first 8 values, 0 0 12 12 0 0

  • 0

my byte array has these first 8 values,
0 0 12 12
0 0 127 224

However when I read the bitarray after conversion,
it has,

0000,0000 0000,0000 0011,0000 0011,0000
0000,0000 0000,0000 1111,1110 0000,0111

I have no idea why bitarray have these values…

ANybody knows why this is happening?

Code used for the conversion is;

byte[] bytes = System.IO.File.ReadAllBytes(args[0]);

BitArray bits = new BitArray(bytes);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:24:10+00:00Added an answer on June 10, 2026 at 5:24 am

    All the bits need to be read from right to left in order to make sense.

    0000,0000
    0000,0000
    0011,0000 –> 00001100 = 12
    0011,0000
    0000,0000
    0000,0000
    1111,1110 –> 01111111 = 127
    0000,0111

    That’s just the way the BitArray works.

    http://msdn.microsoft.com/en-us/library/x1xda43a.aspx

    The first byte in the array represents bits 0 through 7,
    the second byte represents bits 8 through 15, and so on.
    The Least Significant Bit of each byte represents the lowest index value:
    "bytes [0] & 1" represents bit 0,
    "bytes [0] & 2" represents bit 1,
    "bytes [0] & 4" represents bit 2,
    and so on.
    

    So the least significant bit of the first byte in the array is bit 0 in the bit array and the second least significant bit of the first byte in the array is bit 1 in the bit array.

    I have no idea why they did it that way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert a String to a byte array which has 2 different
I have a control that has a byte array in it. Every now and
I'm using ASP.NET MVC and have a model which has an image (byte array)
I have a List<byte[]> . Each byte array is of size 16bytes. The first
I currently use these two functions to pack and read bits in a byte
I have an object that has a byte array property 'ZipFile' to store a
I have a byte array which needs to be marshalled into the following struct:
I have a byte array and I need to convert this to a image.
I have a byte array, received from java application via network. I need to
How to Convert a byte array into an int array? I have a byte

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.