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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:25:13+00:00 2026-06-14T15:25:13+00:00

I have a integer value which, when some condition are met, must be modified

  • 0

I have a integer value which, when some condition are met, must be modified like in this example :

00000001 10000000 11111111 00000000

becomes

11111111 00000000 00000001 10000000

The first 16 bit word must become the second and vice-vera. I know I can easily convert my long into a array of 0 and 1 and then I could use powers of 2 to reconstruct the long that I way I need it, but I was wondering is there was any other, better and faster way to do it. By faster I mean execution wise. If it’s more complicated but have a better result, it’s still fine with me.

thanks

  • 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-14T15:25:14+00:00Added an answer on June 14, 2026 at 3:25 pm

    You can do it with shifts and bitwise or:

    value = (value << 16) | (value >> 16)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I loop over string variable data which may have integer numeric value, like 123
I have this code: EditText value = ( EditText )findViewById( R.id.editbox ); Integer int_value
For example Dim aInt as Integer should have the value as nothing instead of
Lets say I have a function that needs to return some integer value. but
I am creating an iphone app in which i have some vale in integer
I have some LessCSS that essentially looks like this: .foo { @height: 20px; @iconHeight:
I have a DB2 query in a shell script which return an integer value,
I have an integer value that spans a range so large it is impractical
Given I have an integer value of, e.g., 10 . How can I create
Say I have an integer value that I output to a django template say

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.