当前位置:网站首页>Float.floatToRawIntBits的返回值具体意思,将float转为byte数组
Float.floatToRawIntBits的返回值具体意思,将float转为byte数组
2022-07-05 19:34:00 【一天不写代码难受】
1 代码
int i = Float.floatToRawIntBits(9f);
2 解释
返回的就是该数值的浮点数的十进制数字。
3 什么时候使用这个
我们需要将二维数组变为图片,一般是使用byte转换,也就是先将二维数组里面的float的值使用这个 Float.floatToRawIntBits(9f)
转为int,
之后
public static byte[] getBytes(int Float.floatToRawIntBits(x)) {
return new byte[] {
(byte) x, (byte) (x >>> 8), (byte) (x >>> 16),
(byte) (x >>> 24) };
}
比如 传入的x 为1.0f
输出为
[0, 0, -128, 63]
以上就实现了将float转为byte数组
边栏推荐
- Debezium系列之:解析默认值字符集
- Reflection and imagination on the notation like tool
- 强化学习-学习笔记4 | Actor-Critic
- Shell编程基础(第8篇:分支语句-case in)
- PG basics -- Logical Structure Management (user and permission management)
- UWB超宽带定位技术,实时厘米级高精度定位应用,超宽带传输技术
- 众昂矿业:2022年全球萤石行业市场供给现状分析
- 集合
- The relationship between temperature measurement and imaging accuracy of ifd-x micro infrared imager (module)
- 数学分析_笔记_第9章:曲线积分与曲面积分
猜你喜欢
【无标题】
How to convert word into PDF? Word to PDF simple way to share!
#夏日挑战赛#数据库学霸笔记,考试/面试快速复习~
Go语言 | 02 for循环及常用函数的使用
MMO项目学习一:预热
Can Leica capture the high-end market offered by Huawei for Xiaomi 12s?
The problem of returning the longtext field in MySQL and its solution
The relationship between temperature measurement and imaging accuracy of ifd-x micro infrared imager (module)
大厂面试必备技能,2022Android不死我不倒
JMeter 常用的几种断言方法,你会了吗?
随机推荐
建议收藏,我的腾讯Android面试经历分享
shell编程基础(第9篇:循环)
Oracle fault handling: ora-10873:file * needs to be either taken out of backup or media recovered
JAD的安装、配置及集成IDEA
Pandora IOT development board learning (HAL Library) - Experiment 8 timer interrupt experiment (learning notes)
JS solution force deduction daily question (12) - 556 Next larger element III (2022-7-3)
Information / data
Can Leica capture the high-end market offered by Huawei for Xiaomi 12s?
什么是面上项目
信息/数据
Oracle故障处理:Ora-10873:file * needs to be either taken out of backup or media recovered
How to choose the notion productivity tools? Comparison and evaluation of notion, flowus and WOLAI
C#应用程序界面开发基础——窗体控制(6)——菜单栏、工具栏和状态栏控件
Xaas trap: all things serve (possible) is not what it really needs
Reflection and imagination on the notation like tool
微波雷达感应模块技术,实时智能检测人体存在,静止微小动静感知
PG basics -- Logical Structure Management (user and permission management)
redis集群模拟消息队列
Debezium系列之:解析默认值字符集
JAD installation, configuration and integration idea