在android中将hexstring转换为Float [英] Converting hexstring to Float in android

查看:212
本文介绍了在android中将hexstring转换为Float的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将hexstring转换为float值。例如。 00E1应显示为0.225 ...即00E1转换为十进制并将其除以1000.请帮助所需查询。

I need to convert a hexstring to a float value. For eg. 00E1 should be displayed as 0.225... i.e 00E1 converted to decimal and its been divided by 1000. Please help what is the required query.

推荐答案

阅读本文:< a href =http://stackoverflow.com/questions/5886619/hexadecimal-to-integer-in-java> http://stackoverflow.com/questions/5886619/hexadecimal-to-integer-in-java [ ^ ]


这里有你需要的细分:

Here a breakdown of what you need:
String hexValue = "00E1";
int intValue = Integer.parseInt(hexValue , 16);
float floatValue = intValue / 1000.0f;



祝你好运!


Good luck!


这篇关于在android中将hexstring转换为Float的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆