tohexstring方法

浮动类toHexString()方法 (Float class toHexString() method)

  • toHexString() method is available in java.lang package.

    toHexString()方法在java.lang包中可用。

  • toHexString() method is used to represent a hexadecimal string of the given parameter [value] of single-precision floating-point type.

    toHexString()方法用于表示单精度浮点类型的给定参数[value]的十六进制字符串。

  • toHexString() method is a static method, it is accessible with the class name too and if we try to access the method with the class object then also we will not get an error.

    toHexString()方法是一个静态方法,也可以使用类名进行访问,并且如果我们尝试使用类对象访问该方法,那么我们也不会收到错误。

  • toHexString() method does not throw an exception at the time of conversion from float to Hexadecimal string.

    从float转换为16进制字符串时, toHexString()方法不会引发异常。

Syntax:

句法:

    public static String toHexString (float value);

Parameter(s):

参数:

  • float value – represents the float value to be converted.

    浮点值 –表示要转换的浮点值。

Return value:

返回值:

The return type of this method is String, it returns the hexadecimal string of the given parameter that represent the float value.

此方法的返回类型为String ,它返回给定参数的代表十六进制值的十六进制字符串。

Example:

例:

// Java program to demonstrate the example
// of toHexString(float value) method of Float class
public class ToHexStringOfFloatClass {public static void main(String[] args) {// Variables initialization
float f1 = 10.0f;
float f2 = 20.0f;
float f3 = 30.0f;
float f4 = Float.MAX_VALUE;
float f5 = Float.MIN_VALUE;
// Float instance creation
Float value = new Float(f1);
// It represents hexadecimal string of the given
// float type f2 argument
String s = value.toHexString(f2);
// Display Hexadecimal String Representation
System.out.println("value.toHexString(f2): " + s);
// It represents hexadecimal string of the given
// float type f3 argument
s = value.toHexString(f3);
// Display Hexadecimal String Representation
System.out.println("value.toHexString(f3): " + s);
// It represents hexadecimal string of the given
// float type f4 argument
s = value.toHexString(f4);
// Display Hexadecimal String Representation
System.out.println("value.toHexString(f4): " + s);
// It represents hexadecimal string of the given
// float type f5 argument
s = value.toHexString(f5);
// Display Hexadecimal String Representation
System.out.println("value.toHexString(f5): " + s);
}
}

Output

输出量

value.toHexString(f2): 0x1.4p4
value.toHexString(f3): 0x1.ep4
value.toHexString(f4): 0x1.fffffep127
value.toHexString(f5): 0x0.000002p-126

翻译自: https://www.includehelp.com/java/float-class-tohexstring-method-with-example.aspx

tohexstring方法

tohexstring方法_Java Float类toHexString()方法的示例相关推荐

  1. Java中的isnan函数_Java Float类isNaN()方法与示例

    语法:public boolean isNaN (); public static boolean isNaN(float value); float 类isNaN()方法isNaN()方法在java ...

  2. java parsefloat 误差_Java Float类parseFloat()方法与示例

    Float类parseFloat()方法parseFloat()方法在java.lang包中可用. parseFloat()方法用于返回与给定String表示形式相对应的float值,换句话说,我们可 ...

  3. tohexstring方法_Java Long类toHexString()方法的示例

    tohexstring方法 长类toHexString()方法 (Long class toHexString() method) toHexString() method is available ...

  4. JAVA的infinite_Java Float类isInfinite()方法与示例

    语法:public boolean isInfinite (); public static boolean isInfinite (float value); Float类isInfinite()方 ...

  5. java 同类调用方法_JAVA中同类中方法的调用问题?

    1.为什么可以直接new+构造方法,来创建对象.而不用创建实例引用呢,像常见的这种:Car car1=new Car;我记得看过有说java中没有被引用的对象将被GC处理.那这个算不算. 你创建了一个 ...

  6. java arrays方法_Java工具类Arrays中不得不知的常用方法

    原标题:Java工具类Arrays中不得不知的常用方法 Arrays 数组操作集数组转List ---asList 这个被"普遍"称为数组转List的方法,可能是Arrays内大家 ...

  7. java getmethod类_Java Class类 getMethod()方法及示例

    Class类getMethod()方法getMethod()方法在java.lang包中可用. getMethod()方法用于返回Method对象,这些对象指示该类的给定公共方法或由此Class对象表 ...

  8. java实验报告 05 类与_java程序设计类与方法-java实验报告

    java程序设计类与方法-java实验报告 java程序设计类与方法-java实验报告 1. 实验内容或题目 (1) 编写Java应用程序,实现以下功能:当应用程序运行后,根据屏幕提示进行交互式输入并 ...

  9. java void方法_Java对象类的最终void wait(long ms)方法,包含示例

    java void方法 对象类最终无效等待(长毫秒) (Object Class final void wait(long ms)) This method is available in java. ...

最新文章

  1. 再见!Python不想再被这么搞了!
  2. 区块链今年,胜过过去十年
  3. 观《phonegap第三季 angularjs+ionic视频教程 实时发布》学习笔记(一)
  4. python下载网络错误_下载失败,出现“网络错误”+40000
  5. php get_extension_funcs,get_extension_funcs()
  6. 线上问题随笔记录数据库连接池问题
  7. 程序员每天少吃===活120岁
  8. 【WPF】设置DataGrid表头内容居中显示
  9. 苹果输了,赔了高通 2 个亿
  10. DVWA中国菜刀连接不上问题(低安全级别就连不上,看看这!!)
  11. 如何在一个月内通过PMP考试?(含资源)
  12. 蒙特卡洛近似的一些例子
  13. Hbase 操作命令
  14. 联想笔记本prtsc不能截图_笔记本上Fn+PrtSc 组合键无法调出截屏工具 Fn和Ctrl功能怎么交换...
  15. 【新书推荐】【2021】基于多源信息融合的航天器自主导航技术
  16. 一种video视频兼容IE的模式
  17. 就业推荐表鉴计算机水平,毕业生就业推荐表的鉴定评语
  18. 【其他】【RQNOJ】同分异构体
  19. Fiddler / Charles - 夜神模拟器证书安装App抓包
  20. Java面向对象程序设计(第二版)袁绍欣 第九章课后习题答案

热门文章

  1. 表字段顺序有何影响_「品味保定」炸烹虾段乾隆赞 百年保定柔雅香
  2. 表格里面怎么打多个√_Excel怎样在表格里打√?
  3. Ubuntu root账号的使用
  4. Linux Note
  5. WCF学习笔记(三):开启net.tcp端口
  6. 存储芯片在智能化产业链中扮演的角色将更加重要
  7. 与专门团队一起持续交付
  8. 给孩子一束安全的光 明基WiT MindDuo亲子共读灯首发评测
  9. JConsole的使用手册 JDK1.5(转)
  10. GB/T 17710-1999 PHP生成校验码