Dirt McCrasse
Dirt McCrasse

Reputation: 42

Java BitShift difference between 32 and 64 bit JVM

I'm currently migrating a Java Application from 32 to 64 bits and I wanted to know if there is a behavior change with the different binary operators when switching between 32 and 64 bit jvm, more particularly the bit shift operators (<<, >> and >>>).

Thanks!

Upvotes: 0

Views: 190

Answers (2)

Robert Harvey
Robert Harvey

Reputation: 180798

The Java language and the JVM are a standards-based platform. The way that standard works is that programs written on it should behave the same, regardless of the underlying hardware platform on which they are run.

Therefore, a bitshift in Java should behave the same whether you run it on a 32 bit machine or a 64 bit machine. The data types (and their behavior) are defined by the language specification, not the underlying hardware platform.

Upvotes: 3

Louis Wasserman
Louis Wasserman

Reputation: 198103

Short answer: no. Long answer: noooooooo.

All Java primitive operations are independent of the word size of both the JVM and the underlying machine.

Upvotes: 3

Related Questions