- Trending Categories
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
DecimalFormat("000000E0") in Java
DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers. Let us set DecimalFormat("000000E0") and use the format() method as well.
new DecimalFormat("000000E0").format(199) new DecimalFormat("000000E0").format(29089)
Since we have used DecimalFormat class in Java, therefore importing the following package is a must −
import java.text.DecimalFormat;
The following is the complete example −
Example
import java.text.DecimalFormat; public class Demo { public static void main(String[] argv) throws Exception { System.out.println(new DecimalFormat("000000E0").format(199)); System.out.println(new DecimalFormat("000000E0").format(29089)); System.out.println(new DecimalFormat("000000E0").format(398987)); System.out.println(new DecimalFormat("000000E0").format(498989)); System.out.println(new DecimalFormat("000000E0").format(6989898)); System.out.println(new DecimalFormat("000000E0").format(7688888)); } }
Output
199000E-3 290890E-1 398987E0 498989E0 698990E1 768889E1
- Related Articles
- DecimalFormat(abc#) in Java
- DecimalFormat("00.00E0") in Java
- DecimalFormat("##E0") in Java
- DecimalFormat("###E0") in Java
- DecimalFormat("00E00") 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 Stream Collectors toCollection() in Java
- Java program to calculate mode in Java
- Convert Java String to Short in Java
- Compare Two Java int Arrays in Java
- Greedy quantifiers Java Regular expressions in java.
- Is Java matcher thread safe in Java?

Advertisements