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

  • Home
  • SEARCH
  • 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 6773467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:40:18+00:00 2026-05-26T15:40:18+00:00

Some of my downloaded c# code include hexadecimal based calculation. eg. int length =

  • 0

Some of my downloaded c# code include hexadecimal based calculation.

eg. int length = ((((byte) hexstr[0x10]) & 0x80) > 0) ? 0x10 : 8;

when i change this code to normal decimal based code like that

int length = ((((byte) hexstr[16]) & 128) > 0) ? 16 : 8;

It give the same solution without giving any error.
It still run correctly.
So what I would like to know is why most of the code use hexadecimal base digit which is more difficult to understand than normal decimal digit.

If there anyone who know this, please let me know it.

  • 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-05-26T15:40:19+00:00Added an answer on May 26, 2026 at 3:40 pm

    It shows the bit pattern more clearly. 0x80 is clearly the value with the top nybble set to 8 and the bottom nybble set to 0… that’s not at all clear from the decimal value.

    As another example, if I wanted to mask the second and third bytes of an integer, I might use:

    int masked = original & 0xffff00;
    

    I wrote that code without a calculator or anything similar. There’s no way I’d have done the same for the decimal equivalent – I can’t multiply 65535 by 256 in my head with any likelihood of success, and the resulting code wouldn’t have been nearly as clear anyway.

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

Sidebar

Related Questions

I wrote an app in C++, and downloaded some samples code from the internet
I was going through some code that I downloaded off the internet ( Got
im trying to extract some files from a jar-file downloaded using java-webstart. below code
Recently downloaded some code for a minor open-source project related to a small webgame
We have some JavaScript code that resizes <div/> elements (adjusts height/width/padding/margin etc.) based on
I downloaded some code that make use of libjpeg, but no dlls in the
I've got some code which downloads some RSS feeds. I've been using WebClient or
I have some code that downloads an image from a remote server $data =
I need some code to download a pdf file. what i mean is normaly
I'm writing code to download email from various servers, some of which are outside

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.