File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Problem with NumberFormat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Problem with NumberFormat " Watch "Problem with NumberFormat " New topic

Problem with NumberFormat

Srinivas Kalvala
Ranch Hand

Joined: Oct 20, 2005
Posts: 257


I am unable to convert the format of the number to different locale. I have attached the program and sample output. Can any one help in this one.


package com.srinivas.scea.test;

import java.text.NumberFormat;
import java.util.Locale;


public class NumberFormatTest {
public static void main(String s[])
java.util.Locale locale=Locale.getDefault();
NumberFormat numberFormat= NumberFormat.getNumberInstance(locale);
locale=new Locale("hi","IN");
System.out.println("Count "+locale.getCountry());
System.out.println("Language " +locale.getDisplayLanguage());
catch(Exception e)


Output :

Count IN
Language Hindi


Problem: When I try to convert the format to INDIA locale, it is giving ???,???.

Thank you,
Srinivas Kalvala
Ranch Hand

Joined: Oct 20, 2005
Posts: 257

Please ignore unnecessary imports in that program.

Thank you.
sai maddikay

Joined: Jul 03, 2006
Posts: 14
could be that the system should support the Hindi font to get the numbers displayed. did you try some other locale like en_US or en_GB?

[ August 03, 2006: Message edited by: jagi jagi ]
Santiago Urrizola
Ranch Hand

Joined: Apr 27, 2006
Posts: 172
happens the same to me, could you try to put this outupt in a jsp ? and set the apropiated encoding ?

Santiago Urrizola : La Plata - Argentina<br />SCEA (89%-92%)<br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: Problem with NumberFormat
It's not a secret anymore!