简体   繁体   English

在Java中将int签名为16位十六进制字符串

[英]Signed int to 16 bit hex string in Java

I use this code 我用这个代码

short s = (short) Integer.parseInt("3321",16);

to convert from 3321 to 13089 3321转换为13089

How can I make the inverse and convert from 13089 to 3321 ? 如何进行逆向转换并从13089转换为3321

Integer provides a method for this . Integer 为此提供了一种方法

String out = Integer.toHexString(13089);

out will have the value "3321" . out将具有值"3321"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM