jkbbwr
01/06/2018, 2:07 AMbyte b1 = (byte) 0xAD;
byte b2 = (byte) 0xCA;
short s = (short) (b1<<8 | b2);
Max Russek
01/06/2018, 2:19 AMval b1 = 0xAD.toByte()
val b2 = 0xCA.toByte()
val s = (b1.toInt() shl 8 or b2.toInt()).toShort()
louiscad
01/06/2018, 2:33 AMLong
and Int
. Java casts byte and shorts at compilation, but in Kotlin, is has to be explicit