JAVA Internalization Tutorial
Selected Reading
- Java I18N - Discussion
- Java I18N - Useful Resources
- Java I18N - Quick Guide
- JAVA I18N - From Reader and To Writer Conversion
- JAVA I18N - From and To String Conversion
- JAVA I18N - UTC
- JAVA I18N - Date Format Patterns
- JAVA I18N - DateFormatSymbols Class
- JAVA I18N - Formatting Date
- JAVA I18N - SimpleDateFormat Class
- JAVA I18N - Formatting Date and Time
- JAVA I18N - Formatting Time
- JAVA I18N - Formatting Dates
- JAVA I18N - DateFormat Class
- JAVA I18N - Grouping Digits
- JAVA I18N - DecimalFormatSymbols Class
- JAVA I18N - Locale Specific DecimalFormat
- JAVA I18N - Formatting Patterns
- JAVA I18N - DecimalFormat Class
- JAVA I18N - Parsing Numbers
- JAVA I18N - Set Rounding Mode
- JAVA I18N - Set Min/Max Precision
- JAVA I18N - Format Percentages
- JAVA I18N - Format Currencies
- JAVA I18N - NumberFormat Class
- JAVA I18N - ResourceBundle Class
- JAVA I18N - Display Language
- JAVA I18N - Locale Details
- JAVA I18N - Locale Class
- JAVA I18N - Environment Setup
- JAVA I18N - Overview
- JAVA I18N - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
JAVA I18N - Grouping Digits
Java Internapzation - Grouping Digits
Using setGroupingSize() method of DecimalFormat, default grouping of numbers can be changed. Following example is illustrating the same.
IOTester.java
import java.text.DecimalFormat; pubpc class I18NTester { pubpc static void main(String[] args) { double number = 121223232473.4567; DecimalFormat decimalFormat = new DecimalFormat(); System.out.println(number); System.out.println(decimalFormat.format(number)); decimalFormat.setGroupingSize(4); System.out.println(decimalFormat.format(number)); } }
Output
It will print the following result.
1.212232324734567E11 121,223,232,473.457 1212,2323,2473.457