
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
DecimalFormat("00E00") in Java
DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers.
Let us set DecimalFormat("00E00") first.
Format f = new DecimalFormat("00E00");
Now, we will format a number and display the result in a string using the format() method −
String res = f.format(-5977.3427);
Since, we have used both Format and DecimalFormat class in Java, therefore importing the following packages in a must −
import java.text.DecimalFormat; import java.text.Format;
The following the complete example −
Example
import java.text.DecimalFormat; import java.text.Format; public class Demo { public static void main(String[] argv) throws Exception { Format f = new DecimalFormat("00E00"); String res = f.format(-5977.3427); System.out.println(res); } }
Output
-60E02
- Related Questions & Answers
- DecimalFormat("000000E0") in Java
- DecimalFormat("00.00E0") in Java
- DecimalFormat("##E0") in Java
- DecimalFormat("###E0") in Java
- DecimalFormat("000E00") in Java
- DecimalFormat("0000000000E0") in Java
- DecimalFormat("0.######E0") in Java
- Format double with new DecimalFormat("0.#####E0") in Java
- Java regex program to match parenthesis "(" or, ")".
- "static const" vs "#define" vs "enum" ?
- Regular Expression "[^...]" construct in Java
- Difference between "." and "#" selector in CSS
- Regular Expression "^" (caret) Metacharacter in Java
- Regular Expression "$" (dollar) Metacharacter in Java
- Regular Expression "." (dot) Metacharacter in Java
Advertisements