![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Floating-point hexadecimal in Java
For Floating-point hexadecimal form, use the %a format specifier.
For Formatter, import the following package −
import java.util.Formatter;
Now create a Formatter object like this −
Formatter f = new Formatter();
Use the format() method for floating-point hexadecimal −
f.format("%a", 298.45)
The following is an example −
Example
import java.util.Formatter; public class Demo { public static void main(String args[]) { Formatter f = new Formatter(); // Floating-point hexadecimal form System.out.println(f.format("%a", 298.45)); } }
Output
0x1.2a73333333333p8
Advertisements