【问题标题】:Signed int to 16 bit hex string in Java在 Java 中将 int 签名为 16 位十六进制字符串
【发布时间】:2017-03-18 06:41:51
【问题描述】:

我用这个代码

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

3321 转换为13089

如何进行逆运算并将13089 转换为3321

【问题讨论】:

  • short s = (short) Integer.parseInt("13089",10); ?
  • 不,结果是13089

标签: java int hex short


【解决方案1】:

Integer 提供了一个method for this

String out = Integer.toHexString(13089);

out 的值为 "3321"

【讨论】:

    猜你喜欢
    • 2013-02-18
    • 2019-07-23
    • 2012-04-27
    • 2013-02-01
    • 2019-01-09
    • 2020-01-18
    • 1970-01-01
    • 2015-11-23
    • 1970-01-01
    相关资源
    最近更新 更多