当前位置:网站首页>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数组
边栏推荐
- Go语言 | 03 数组、指针、切片用法
- 四万字长文说operator new & operator delete
- Go语言 | 02 for循环及常用函数的使用
- 成功入职百度月薪35K,2022Android开发面试解答
- Inventory of the most complete low code / no code platforms in the whole network: Jiandao cloud, partner cloud, Mingdao cloud, Qingliu, xurong cloud, Jijian cloud, treelab, nailing · Yida, Tencent clo
- C#应用程序界面开发基础——窗体控制(6)——菜单栏、工具栏和状态栏控件
- Android面试,android音视频开发
- UWB超宽带定位技术,实时厘米级高精度定位应用,超宽带传输技术
- Notion 类生产力工具如何选择?Notion 、FlowUs 、Wolai 对比评测
- redis集群模拟消息队列
猜你喜欢

Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL

C#应用程序界面开发基础——窗体控制(5)——分组类控件
![[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform](/img/64/08faef0fccec93337f0716ac57dd8e.jpg)
[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform

Xaas trap: all things serve (possible) is not what it really needs

JAD installation, configuration and integration idea

C application interface development foundation - form control (5) - grouping control
The problem of returning the longtext field in MySQL and its solution

Tutoriel de téléchargement et d'installation du progiciel fuzor 2020

【C语言】字符串函数及模拟实现strlen&&strcpy&&strcat&&strcmp

Go语言 | 01 WSL+VSCode环境搭建避坑指南
随机推荐
Webuploader file upload drag upload progress monitoring type control upload result monitoring control
Teach you to deal with JS reverse picture camouflage hand in hand
HiEngine:可媲美本地的云原生内存数据库引擎
IBM has laid off 40 + year-old employees in a large area. Mastering these ten search skills will improve your work efficiency ten times
强化学习-学习笔记4 | Actor-Critic
How to convert word into PDF? Word to PDF simple way to share!
#夏日挑战赛#数据库学霸笔记,考试/面试快速复习~
Mariadb root用户及普通用户的密码 重置
618“低调”谢幕,百秋尚美如何携手品牌跨越“不确定时代”?
Decision tree and random forest
毫米波雷达人体感应器,智能感知静止存在,人体存在检测应用
HiEngine:可媲美本地的云原生内存数据库引擎
Mysql如何对json数据进行查询及修改
Pandora IOT development board learning (HAL Library) - Experiment 8 timer interrupt experiment (learning notes)
okcc呼叫中心有什么作用
建议收藏,我的腾讯Android面试经历分享
5 years of experience, 27 days of Android programmer interview, 2022 programmer advanced classic
Common interview questions in Android, 2022 golden nine silver ten Android factory interview questions hit
How to choose the notion productivity tools? Comparison and evaluation of notion, flowus and WOLAI
HAC cluster modifying administrator user password