当前位置:网站首页>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数组
边栏推荐
- Reptile exercises (II)
- 数据库 逻辑处理功能
- 手机开户选择哪家券商公司比较好哪家平台更安全
- 不愧是大佬,字节大牛耗时八个月又一力作
- Force buckle 729 My schedule I
- 【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法
- Hiengine: comparable to the local cloud native memory database engine
- C application interface development foundation - form control (6) - menu bar, toolbar and status bar controls
- Postman core function analysis - parameterization and test report
- 【无标题】
猜你喜欢
太牛了,看这篇足矣了
[performance test] jmeter+grafana+influxdb deployment practice
使用easyexcel模板导出的两个坑(Map空数据列错乱和不支持嵌套对象)
The problem of returning the longtext field in MySQL and its solution
Go语言 | 03 数组、指针、切片用法
Millimeter wave radar human body sensor, intelligent perception of static presence, human presence detection application
That's awesome. It's enough to read this article
Do you know several assertion methods commonly used by JMeter?
XaaS 陷阱:万物皆服务(可能)并不是IT真正需要的东西
四万字长文说operator new & operator delete
随机推荐
Ten years at sea: old and new relay, dark horse rising
大厂面试必备技能,2022Android不死我不倒
Oracle fault handling: ora-10873:file * needs to be either taken out of backup or media recovered
HiEngine:可媲美本地的云原生内存数据库引擎
Advanced application of C # language
Worthy of being a boss, byte Daniel spent eight months on another masterpiece
Webuploader file upload drag upload progress monitoring type control upload result monitoring control
14、用户、组和权限(14)
四万字长文说operator new & operator delete
MySQL中字段类型为longtext的值导出后显示二进制串方式
third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctl
C#应用程序界面开发基础——窗体控制(6)——菜单栏、工具栏和状态栏控件
MMO項目學習一:預熱
What do software test engineers do? How about the prospect of treatment?
JS solution force deduction daily question (12) - 556 Next larger element III (2022-7-3)
开源 SPL 消灭数以万计的数据库中间表
[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform
JMeter 常用的几种断言方法,你会了吗?
IBM has laid off 40 + year-old employees in a large area. Mastering these ten search skills will improve your work efficiency ten times
【无标题】