Hi,
I read some articals, some developers suggest to use byte/short in some declaration instead of int. Becos it can save memory (runtime) and spaces (jar). But according to Java spec, byte/short would be converted to int when they are in operations. It makes me confused, if bye/short will be converted to ints. It's useless that using byte/short to declare variables, even I can confirm some variables' range are 0 ~ 255. For examples, I SHOULD use a byte to declare a for-loop (the maximum value is 10, byte is good enough to be used to declare b) :
for (byte b = 0 ; b < 10 ; b++) {}
instead of
for (int b = 0 ; b < 10 ; b++) {}
But my problem is that b will be converted to int here ? Becos of 'b++' ?
My purpose is saving the memory/jar size.
Thanks.