This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I did a bit of searching, and it looks like java.text.DecimalFormat might do what you want. in particular, it's got a setParseBigDecimal method, and once that's set to true then the parse method returns BigDecimals.
You can usually get a locale-specific DecimalFormat using NumberFormat.getInstance, and casting it to a DecimalFormat. According to the Javadocs: "This will work for the vast majority of locales; just remember to put it in a try block in case you encounter an unusual one. "
David Garratt wrote:What I don't understand is why the following code when run on an Italian machine generates an exception for the following line of code
Double temp = Double.valueOf(localeQuantity);
If you look at the API for java.lang.Double, valueOf(String) isn't designed to use any localized format. It uses a standard format that will be the same on any machine anywhere in the world. Which can be very convenient for certain applications, but isn't what you want. The same API suggests if you need to use a localized format, use NumberFormat instead. Double.parseDouble() simply isn't designed for what you want to do.