- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
- Related Articles
- Format floating point number in Java
- Floating-point conversion characters in Java
- Floating point operators and associativity in Java
- Format floating point with Java MessageFormat
- Apply modulus operator to floating-point values in Java
- Java program to multiply given floating point numbers
- Java Program to Multiply Two Floating-Point Numbers
- Floating Point Operations and Associativity in C, C++ and Java
- Floating point comparison in C++
- C++ Floating Point Manipulation
- Signed floating point numbers
- Fixed Point and Floating Point Number Representations
- Decimal fixed point and floating point arithmetic in Python
- What is the difference between integer and floating point literals in Java?
- PHP Floating Point Data Type

Advertisements