It's necessary to use a postfix delimiter to denote the type of constant being used in the source code, like L for long. However, for shorts and bytes there are no delimiters, so I need to explicitly cast the constant value like so:
short x = (short)0x8000;
I was wondering if Java takes extra steps in the compiled bytecode to actually convert this from an integer type to a short, or does it know that this will fit into a word and use the constant as is? Otherwise, is there a way I can postfix numbers like these to denote short or byte?