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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:23:03+00:00 2026-06-14T03:23:03+00:00

Can someone explain to me why .net is calculating these differently to Java The

  • 0

Can someone explain to me why .net is calculating these differently to Java

The equation

(-1646490243 << 4) + 3333 ^ -1646490243 + -957401312 ^ (-1646490243 >> 5) + 4

Java calculates it as

1173210151

.Net calculates as

-574040108

My issue is that I need .Net to calculate the same as Java as i’m porting across a decryption function and if it calculates differently then the decryption isn’t going to be right.

Any help would be appreciated.

–Update–

Thanks guys, Xor was what I should of been using. Plus need to workaround Java not throwing an exception when an Integer number is too big.

Xor gives a result of -3121757145

(-1646490243 << 4) + 3333 Xor -1646490243 + -957401312 Xor (-1646490243 >> 5) + 4

Combine this with the answer from this link I found – Java sum 2 negative numbers. Gives the same result as Java

-3121757145 + 2 ^ 32 = 1173210151
  • 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-14T03:23:04+00:00Added an answer on June 14, 2026 at 3:23 am

    I checked the operator precedence table for Java and Visual Basic, they’re the same regarding the operators in the expression. So it’s not a problem with precedence.

    Be aware though, in Visual Basic ^ is the operator for exponentiation, whereas Xor is the operator for exclusive or. That’s different from Java, which uses the ^ operator as exclusive or and doesn’t have an operator for exponentiation. All the other operators in the expression are the same in both languages

    I can’t tell from the code if the snippet is the one in Java or the one in Visual Basic – I’m guessing is in Java. If that’s the case, it’s quite possible that you’ve confused the exclusive or; try replacing ^ with Xor in the Visual Basic code and see if that fixes the problem:

    (-1646490243 << 4) + 3333 Xor -1646490243 + -957401312 Xor (-1646490243 >> 5) + 4
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone explain how the ASP.NET Web Development Server work? I don't have IIS
Can someone explain how to use JSON-RPC.net in my application for windows phone. When
Can someone explain exactly how/when an ObjectDataSource fires? I have an ASP.NET page, with
Excuse the 'noob' question, but can someone please explain the way ASP.NET's buttons work.
Can someone explain what is json method and it use in .net
Can someone explain to me why in .NET I would write String.IsNullOrEmpty(str) instead of
Can someone explain this paragraph on page 258(Pro ASP.NET MVC 1.0 Chapter 6: Using
Can someone explain to me why in .NET 2.0 if I have an interface,
Can someone explain me about SQL Server Reporting Service and using it in ASP.net?
Can someone explain this to me? In Visual Studio 2010, create a VB.net Windows

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.