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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:16:06+00:00 2026-06-16T08:16:06+00:00

I have a latitude value as double and I want to perform a Bitwise

  • 0

I have a latitude value as double and I want to perform a Bitwise AND operation on it followed by right shift of bits. Following is my line of code:

pBuffer[1]=(latitude_decimal_degrees & 0xFF0000) >> 16;

However a Bitwise AND operation between a double and int value is not possible. I cannot convert the latitude to int as this would not yield an accurate value. Can anybody guide me in this?

EDIT: My requirement is basically to translate the following vb.net code into java. Reason: The lines of code below (vb.net) is part of a method written in “Basic4Android” for an android app. The exact same method is to be implement in my BlackBerry App. Therefore I need to have the exact same value generated as below which will be decoded at the server end:

Dim pBuffer(11) As Int
Dim longitude_decimal_degrees As Double
pBuffer(1)=Bit.ShiftRight(Bit.And(latitude_decimal_degrees, 0xFF0000),16)

How can these lines of code be translated into java?

  • 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-16T08:16:07+00:00Added an answer on June 16, 2026 at 8:16 am

    You can turn the double into a long via bits using Double.doubleToRawLongBits(latitude_decimal_degrees) perform all bitwise operations in the long space, then convert back to a double via longBitsToDouble

    See also this SO answer: https://stackoverflow.com/a/4211117/504685

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

Sidebar

Related Questions

I have a latitude and longitude values as a double value(37.33168900, -122.03073100). I want
How do I get postal code value for a location if I have Latitude
I have a string value. NSString *myString = @Latitude:-31.9504140#Longitude:115.8606040; How can I retrieve the
i have latitude and longitude of a location and i want to find nearby
i have latitude and longitude of particular place and i want to calculate the
I have a couple of properties in C# which are double and I want
I have tried this method to get Altitude, using longitude and latitude private double
I have a table with the following attributes: MyTable: - double longitude - double
Suppose, I have a vector with following values in it id = 100 latitude
I have a NSArray with numbers and I want to get the value of

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.