Roedy said:
Would you not write
byte c = (byte) Math.min ( a, b );
How do you pull it off without additional source code, namely the
(byte)?
I think it's been mentioned here on this list that the JVM and the
language spec require bytes to be promoted to ints for any kind of
arithmetic or logical operation. The Java language merely implements
what is possible on current JVMs in this respec. There is no operation
for comparing bytes in JVMs, so you might as well promote then cast it,
because that's what the JVM is going to do.
Whether it's truly correct for Java to follow the JVM capabilities so
closely in this regard is another debate. I think that's why there are
no byte or char versions of min or max.