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 4123328
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:35:51+00:00 2026-05-20T23:35:51+00:00

I want to find the value of a byte in a large integer. For

  • 0

I want to find the value of a byte in a large integer. For example the number

11973777 = 10110110 10110100 10010001

I would like to find that

11973777[2] = 10110110 = 182
11973777[1] = 10110100 = 180 
11973777[0] = 10010001 = 145

And do so efficiently(bitwise operations). I can easily find the value of a bit at any position in the number with a bitwise operation but I don’t want to do that 8 times just to get the byte, or shift left then shift right. This is tagged as javascript because I am doing it in javascript but I suppose bitwise operations can be translated. Thank you in advance for any help you can lend.

  • 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-20T23:35:51+00:00Added an answer on May 20, 2026 at 11:35 pm

    To a certain extent, you have to bit-shift:

    var num = 11973777;
    var lastByte = num & 0xFF;
    var midLowByte = (num >> 8) & 0xFF;
    var midHighByte = (num >> 16) & 0xFF;
    var highByte = (num >> 24) & 0xFF;
    

    But you can always package the logic in a function to make it more convenient, like:

    window.getBytes = function(num) {
        return [num & 0xFF, (num >> 8) & 0xFF, (num >> 16) & 0xFF, (num >> 24) & 0xFF];
    };
    
    var numBytes = getBytes(11973777);
    alert(numBytes[0] + "," + numBytes[1] + "," + numBytes[2] + "," + numBytes[3]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to find integer value from a string. For example, given a String
I want to find out the integer value associated to a string into the
I want to find the max value in a column. Column values are, E00004,
I'm new to the opencv...i want to find the minimum value in the matrix..but
I want to take two lists and find the values that appear in both.
I want to find the first item in a sorted vector that has a
I have OnMouseMove event, during which I want to find a value of certain
I have a string that I want as a byte array. So far I
I want to find last value (ie. lo: ) and just append a value
I want to store 4 boolean possibilities in a single value. For example, I

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.