Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

105
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda