Robert
01/28/2019, 7:38 PMif (myByte.compareTo(myInt) == 0)
? if (myByte.toInt() == myInt)
? if (myByte == myInt.toByte())
? Something else? Or can I force implicit conversion somehow, as I have a lot of these comparisons?jlleitschuh
01/28/2019, 7:42 PMif (myByte.toInt() == myInt)
would be the most appropriate I think.Robert
01/28/2019, 7:43 PMjlleitschuh
01/28/2019, 7:45 PMif (myByte == myInt.toByte())
If there is an overflow in the int to byte conversion, you'll have weird behavior.
if (myByte.compareTo(myInt) == 0)
This is just confusing from a readability perspective and I don't even know if it will compile.hudsonb
01/28/2019, 7:46 PMif (myByte == myInt.toByte())
. 123456.toByte()
is 64
.Robert
01/28/2019, 7:49 PMmyByte.toInt()