【问题标题】:String to HexString conversion字符串到十六进制字符串的转换
【发布时间】:2013-09-05 17:04:47
【问题描述】:

我有一个用十六进制值填充的字符串,如下所示:

received_Value = fffec780

字符串没有被声明为十六进制字符串,它被声明为普通字符串并用这个字符填充。但我必须将其定义为十六进制字符串才能转换为 int。

int_value_receive = Integer.parseInt(received_Value, 16)

因为这样做时我遇到了错误。

【问题讨论】:

  • 您能发布您遇到的错误吗?

标签: android string hex


【解决方案1】:

fffec780 作为int 的值大于MAX_INTEGER

试试这个

Long.parseLong(received_Value, 16);

【讨论】:

  • 我仍然收到此错误:java.lang.NumberFormatException: Invalid long: "fffec780???????????...
猜你喜欢
  • 1970-01-01
  • 2021-03-19
  • 2020-11-07
  • 1970-01-01
  • 2019-07-30
  • 1970-01-01
  • 2012-01-24
相关资源
最近更新 更多