当前位置:网站首页>Pit of kotlin bit operation (bytes[i] and 0xff error)

Pit of kotlin bit operation (bytes[i] and 0xff error)

2022-07-01 06:02:00 lplj717

java Median operation
    bytes yes byte Array
    bytes[i] & 0xff  ( No abnormality )
kotlin Cannot be replaced with  
    bytes[i] and 0xff    ( Error report as shown in the figure , Follow the tips to complete the following )
    (bytes[i] and 0xff.toByte()).toInt()   ( This is still a signed number , Failed to meet expectations )
because kotlin Bit operation only for int The type and long type , Need to change to

bytes[i].toInt() and 0xff
 

原网站

版权声明
本文为[lplj717]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/182/202207010556195342.html