Java and Currency Counting (Brazil)

Hi Experts,

I'm trying to format currency in Brazil but Java simply does not know how to handle this.

ex:
NumberFormat format = NumberFormat.getInstance(new Locale("br"));
Object value = format.parse("5,45");

value ends up translating to 54500.  It's very strange.  Does anyone know why and how I can properly format the value?

Thanks!
Greengiants15Asked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
You're constructing your Locale wrongly. Should be
new Locale("pt", "BR")

Open in new window

0
 
objectsCommented:
0
 
objectsCommented:
and you should be use getCurrencyInstance() to parse a currency value
0
 
CEHJCommented:
:)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.