I read the following in Starting out with Java. from control structures through data structures - 3rd edition by Tony Gaddis on page 67:
When values of the byte or short data types are used in arithmetic expressions, they are temporarily converted to int values.
This is referring to Java.
I was wondering if doing mathematical operations using byte or short data types, although they save memory, increases the processor usage due to the conversion to the int data type, as opposed to just using int data types.
byte x = 2; byte y = 3; int z = x + y;
use more of the processor than this:
int x = 2; int y = 3; int z = x + y;
I understand that the first example uses less memory. And I also understand that the difference in processor usage, if any, would be very slight.