假设您将其作为来自非Java源的二进制数据提供,您必须阅读并使用Java中的值:将其作为(签名)读取short,然后将其转换int为如下所示:
int intVal = shortVal >= 0 ? shortVal : 0x10000 + shortVal
Run Code Online (Sandbox Code Playgroud)
你不能用short表示unsigned short的所有值,但是在int中,你可以.
| 归档时间: |
|
| 查看次数: |
9044 次 |
| 最近记录: |