Primitive data types and portability in Java
I quote Herbert Schildt's Chapter 3 data types, variables and arrays:
What do his last two lines mean? How to specify the size of an integer may result in a small performance loss in some environments?
Solution
In "lower" languages, the size of raw data types usually comes from the ability of the CPU to process them
As mentioned above, Java is different Int, for example, is always 32 bits This means that when you run the same code on different architectures, you don't have to worry about its size change As mentioned above, the trade-off is performance – in any architecture that does not handle 32-bit computing itself, these integers need to be expanded to the native size that the CPU can handle (there will be a small penalty), or worse, if the CPU can only handle small ints, each operation on the int may require multiple CPU operations