Formatting number as per specific locale in java

Ads
 

Formatting number as per specific locale in java

Hi, I am trying to print the number as per locale. I tried below, but it still prints in English locale.

public class loctest {

public static void main(String[] args){

Locale.setDefault(Locale.CHINESE); //set chinese defaullt locale
System.out.println(Locale.getDefault()); //returns zh.

//format the number as per locale --> currently chinese System.out.println(String.format(Locale.getDefault(),"%d",123));

} } //output: zh 123 Am I doing anything wrong?

Thanks. Amit

View Answers

Ads









Related Tutorials/Questions & Answers:
Formatting number as per specific locale in java
Formatting number as per specific locale in java  Hi, I am trying to print the number as per locale. I tried below, but it still prints in English...(Locale.getDefault()); //returns zh. //format the number as per locale -->
Formatting and Parsing Locale-Specific Currency
Formatting and Parsing Locale-Specific Currency In this section, you will learn how to format and parse the locale specific currency. Through the formatting... are going to format the number into locale specific currency using NumberFormat class
Advertisements
Formatting and Parsing a Locale-Specific Percentage
Formatting and Parsing a Locale-Specific Percentage In this section, you will learn how to format and parse a locale-specific percentage. On the basis... are going to format a number into locale specific percentage using NumberFormat class
Formatting and Parsing a Number for a Locale
Formatting and Parsing a Number for a Locale In this section, you will learn how to format and parse a number for a Locale. Formatting converts a date, time... of the date, time, number, or message. Java has provide different classes
Java Locale
Java Locale         A locale class in java api represents a specific geographical, political, or cultural region. In java computing, locale defines a set of parameters
NumberFormat In Java
class for all number formats. This class gives methods for specifying the locale specific number formats and their name. Using this class you can create your code independent from the locale specific for decimal points, thousand
How to format number in Java?
Learn about the code of formatting the number in Java This tutorial explains you how to format the number in Java. There are number of situations where we... of formatting the number is to use the DecimalFormat class. This class is most
Formatting and Parsing a Time for a Locale
Formatting and Parsing a Time for a Locale In this section, you will learn how to format and parse a time for a locale. Java has provide several classes... formatter with the given formatting style for the given locale. The method format
Scanning and Formatting in Java
to the specified locale. public Scanner useLocale(Locale locale) Formatting In Java...Scanning and Formatting in Java In this we will discuss about the Java I/O Scanning and Formatting. In the perspective of programming in Java I/O we
Java get System Locale
Java get System Locale       In this section, you will learn how to obtain the locale. We are providing you an example which will obtain the locale of the system
Formatting a Message Containing a Number
Formatting a Message Containing a Number In this section, you will learn how... that contains a number. The class MessageFormat provides advanced message formatting. It allows advanced value formatting, dependency on Locale and precompilation
Formatting and Parsing a Time for a Locale Using Default Formats
Formatting and Parsing a Time for a Locale Using Default Formats... formats. There are different classes for formatting and parsing number, message... formatter with the given formatting style for the given locale. The method
Formatting a Number in Exponential Notation
Formatting a Number in Exponential Notation In this section, you will learn how to format a number in Exponential Notation. Java has designed several classes for parsing and formatting the numbers like DecimalFormat class. This class
Java Number Format
Java Number Format      ... the format of the number. In java this is achieved by the java.text.NumberFormat class. NumberFormat is the abstract base class for all number formats
Delete specific lines from text in Java
Delete specific lines from text in Java  Hi, beginning in java, i'm trying to delete specific line from a text file. Ex: i want to delete data... number that i want to delete. how could it be possible with java. thanks a lot
Java - How to read a string line per line
Java - How to read a string line per line  Java - How to read a string line per line I am trying to find the tutorial for reading the String line... to read the big String line per line? Is there any API available in Java
Formatting a Number Using a Custom Format
Formatting a Number Using a Custom Format In this section, you will learn how to format a number using a custom format. A number can be formatted in different ways. Java has designed several classes to format the number. Using
How to parse an XML as per dtd in java
How to parse an XML as per dtd in java  Please help to tell me a logic to parse an xml as per mentioned dtd inside xml. I've used SAX and DOM both but that only check for well formed xml tags but don't validate as per DTD. please
How to format number in Java?
How to format number in Java?  Hi, What is the best way to format a number in Java? How to format number in Java? Thanks   Hi, To format number in Java you can use the class java.text.NumberFormat. Here is simple
What is the Locale class?
in java program. thanks,   Hi, The Locale class in Java is Java... region. IN Java computing, locale describes a set of parameters to classify... is called locale-sensitive. For details visit What is Locale class in Java
getting random number in java
getting random number in java  getting random number in java Hi... and scaling the random number in my Java Random number eample. but for some reason... to generate the random number in Java Thanks in Advance
How to extract the entire line with specific data from a Text in java?
How to extract the entire line with specific data from a Text in java? ... of them don't contain number. in Java what method or function could i use to do... to extract only lines with number like 001 or 002 , every line with a number like
program on factorial of a given number in java
program on factorial of a given number in java  please tell me, how to write program on factorial of a given number in java
program on factorial of a given number in java
program on factorial of a given number in java  please tell me, how to write program on factorial of a given number in java
Magic number in java
Magic number in java  Hi.. Can any one tel how to watch a magic number of a program?   import java.util.*; class MagicNumber...); System.out.print("Enter the number: "); int num =input.nextInt(); int b=0,x
Magic number Java Program
Magic number Java Program  write a program that guesses what number the user is thinking of. Below is a sample transcript: Think of a number between 1 and 255. I will guess the number you are thinking of. 1 3 5 7 9 11 13 15 17
Write a program in Java to convert Decimal number into Binary number
Write a program in Java to convert Decimal number into Binary number  Hi, I have decimal number and I want to convert it to Binary. How to Write a program in Java to convert Decimal number into Binary number? Thanks
java code for swaping two number
java code for swaping two number  how to code for swaping two number without taking third variables
Java reverse number
Java reverse number In this tutorial, you will learn how to reverse a number in java. In java, you can use arithmetic operators like division operator(/) and remainder operator(%) to reverse the number. The division operator returns
java write to a specific line
java write to a specific line In this tutorial, you will learn how to write at specific line in text file. Java provides java.io package to perform file operations. Here, we are going to write the text to the specific line of the text
formatting program
formatting program  Hi I needs some help with this program on formating can anyone help?The details of the program are stated below, thanks. This program should be an example of how Java lets you format numbers and strings

Ads