SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

CORE API / NOTES</>↗
Core API12 Aug 2010

How do I change number format symbols?

You can use the DecimalFormatSymbols class to change the symbols that appear in the formatted numbers. These symbols include the decimal separator which can be changed using the setDecimalSeparator(), the grouping separator which can be change using the setGroupingSeparator() method. You can also alter the minus sign, and the percent sign, among others. package org.kodejava.text; […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API11 Aug 2010

How do I change DecimalFormat pattern?

To change the pattern use by the DecimalFormat when formatting a number we can use the DecimalFormat.applyPattern() method call. In this example we use three different patterns to format the given input number. The pattern determines what the formatted number looks like. package org.kodejava.text; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Locale; public class FormatterPattern { public […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API08 Aug 2010

How do I format number as percentage string?

The NumberFormat.getPercentInstance() method returns a percentage format for the specified locale. In this example we will format the number as percentage using the Locale.US locale. package org.kodejava.text; import java.text.NumberFormat; import java.util.Locale; public class LocalePercentageFormat { public static void main(String[] args) { // Format percentage for Locale.US locale with this formatter, // a decimal fraction such […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API04 Aug 2010

How do I format a number as currency string?

Creating a financial application requires you to format number as a currency. It should include the correct thousand separator, decimal separator and the currency symbol. For this purpose you can use the NumberFormat.getCurrencyInstance() method and pass the correct Locale to get the currency format that you want. package org.kodejava.text; import java.text.NumberFormat; import java.util.Locale; public class […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API31 Jul 2010

How do I create a Locale object using a variant?

Font differences may force you to use different characters on different platforms. You could then define the Locale objects with the variant codes to identify those differences. The variant codes conform to no standard. They are arbitrary and specific to your application. If you create Locale objects with variant codes only your application will know […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API26 Jul 2010

How do I get all available Locale language codes?

When you want to internationalize your application, you need to know the language code and country code. These codes will be used as the properties file name (the file name must be ended in language_COUNTRY.properties). Here is an example that show how to get all supported language’s code. package org.kodejava.util; import java.util.Locale; public class LocaleCountryLanguageCode […]

Wayan · 2 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.