Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
Java and Javascript - different results using Unsigned right shift operator

I did a code migration from javascript to java, but the results for the following operation are different:

in javascript:-1316818646 >>> 0 = 2978148650 but in java: -1316818646 >>> 0 = -1316818646

Could someone help me, please? I didn't find the answer elsewhere

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

In Java the operator returns you the same number as an int. In JavaScript the >>> operator always returns you an unsigned 32-bit integer.

about 4 years ago · Juan Pablo Isaza Report

0

As @Pydawan said, 2978148650 is just the unsigned value of -1316818646 or 10110001100000101111000100101010. To get that in Java, call

Integer.toUnsignedLong(-1316818646)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!