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.

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









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
How will you load a specific locale? - Java Beginners
How will you load a specific locale?  HI, Please tell me how to load a specific locale in Java program. Thanks   Hi Friend, You can use ResourceBundle.getBundle("Locale.UK"); For more information, visit
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
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
Java Locale
Java Locale  How will you load a specific locale?   Hi Friend, A locale is the part of a user's environment that brings together.../java/javadate/locale-format.shtml http://www.roseindia.net/tutorial/java
Number Format Example
Number Format Example       This Example shows you how to format numbers according to the locale. In the code given below we are formatting number according to the locale
Locale Specific Date validations through JavaScript/Ajax...
Locale Specific Date validations through JavaScript/Ajax...  Hi, I am developing an JSP Application which supports I18N(Internationalization). In my... JavaScript validation, but change the error/information message as per your local
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...: D:\examples\roseindia.net\corejava>java NumberFormatting Number formatting
Formatting and Parsing a Date for a Locale
Formatting and Parsing a Date for a Locale In this section, you will learn how to format and parse a date for a locale. Java has provide the utility... have used Locale class. This class provides this advantage. In the given
What is Locale - Java Beginners
the following links: http://www.roseindia.net/java/javadate/locale-format.shtml http...What is Locale  Hi, What is Locale? Write example to show the use of Locale. Thanks   Hi Friend, A locale is the part
Scanning and Formatting in Java
locale) Formatting In Java to create a formatted output stream there are two...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
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 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
Java formatting - Java Beginners
Java formatting  I'm creating a 'gift certificate' out line thing. The certificate has to have borders But the right borders will move when...://www.roseindia.net/java/ Thanks
Java Set Default Locale
Java Set Default Locale       Setting Default Locale Example in Java Locale can be set also in our java programs by using the method setDefault() of Locale class
Locale with SimpleDateFormat - Java Beginners
Locale with SimpleDateFormat  What does that mean when instantiating a SimpleDateFormat object,specify a locale? Its just a good programming... in different formats.If you instantiate SimpleDateFormat class without a Locale
Java get default Locale
Java get default Locale       Locale object is a representation of geographical, political, or cultural region. We can get and set our default locale through the java programs
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
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
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
number - Java Interview Questions
number  apka number kya hai aap apna number mera id per send ker do
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
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
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 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 by using
Formatting Date for a Locale Example
Formatting Date for a Locale Example  ... use for formatting and parsing dates. It allows for formatting date into text...[]) {         Locale[] locales = {Locale.UK, Locale.FRANCE, Locale.ITALIAN};         Date date
Locale class
Locale class  What is the Locale class
to retrive e mails as per user name - Java Beginners
to retrive e mails as per user name  hi friends, how to retrive e mails as per user "user name " for ex: class Mail{ private String subject.../reading-message-using-java-mail.shtml Thanks
Java Text Tutorials
Java Text Tutorials In this tutorial we are providing many examples of date and time formatting, number formatting, parsing, iteration over characters... three main groups of classes and interfaces: Iteration over text Formatting
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
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
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
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
number of stairs - Java Beginners
number of stairs  1. Write a program that prints an n-level stair case made of text. The user should choose the text character and the number...(); } } } ----------------------------------- read for more information, http://www.roseindia.net/java/master
prime number - Java Beginners
prime number  i want to write a code in java that picks prime numbers... boolean isPrime(int number){ boolean isPrime=false; int i=(int) Math.ceil(Math.sqrt(number)); while (i>1
prime number - Java Beginners
prime number  this project is to determine if a phone number is a prime number. if the number is a prime number then print a message to the effect. if the number is not a prime number then print the prime factors of the number
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
add number - Java Beginners
add number  Q. write a programe to add three number. The number input... input=new Scanner(System.in); System.out.println("Enter first number"); int a=input.nextInt(); System.out.println("Enter second number"); int b
JSP Locale
JSP Locale          JSP Locale is used to get the preferred locale of the user. A user can configure their browser with a US language locale ("en
Number Convert - Java Beginners
passString(int number){ int num, q ; if (number < 10 ){ displayOutput(a[number...]) ; } if ( number > 19 ){ num = number % 10 ; if ( num == 0 ){ q = number / 10 ; displayOutput (d[q-2]) ; } else{ q = number / 10 ; displayOutput(a[num
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
perfect number - Java Beginners
perfect number  An integer number is said to be a perfect number.... For example, 6 is a perfect number because 6 = 1+2+3. Write a method perfect that determines if parameter number is a perfect number. Use this method
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

Ads