Question: I want to convert some numbers which I got as strings into Doubles, but these numbers are not in US standard locale, but in a different one. How can I do that?

Answer: 
Try [`java.text.NumberFormat`](http://java.sun.com/javase/6/docs/api/java/text/NumberFormat.html). From the Javadocs:

> 
> To format a number for a different Locale, specify it in the call to getInstance.
> 
> 
> 
> ```
> NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH);
> 
> ```
> 
> You can also use a NumberFormat to parse numbers:
> 
> 
> 
> ```
> myNumber = nf.parse(myString);
> 
> ```
> 
> 

[`parse()`](http://java.sun.com/javase/6/docs/api/java/text/NumberFormat.html#parse(java.lang.String)) returns a [`Number`](http://java.sun.com/javase/6/docs/api/java/lang/Number.html); so to get a `double`, you must call [`myNumber.doubleValue()`](http://java.sun.com/javase/6/docs/api/java/lang/Number.html#doubleValue()):

```
    double myNumber = nf.parse(myString).doubleValue();

```

Note that `parse()` will never return `null`, so this cannot cause a `NullPointerException`. Instead, `parse` throws a checked `ParseException` if it fails.

**Edit:** I originally said that there was another way to convert to `double`: cast the result to `Double` and use unboxing. I thought that since a general-purpose instance of `NumberFormat` was being used (per the Javadocs for [`getInstance`](http://java.sun.com/javase/6/docs/api/java/text/NumberFormat.html#getInstance(java.util.Locale))), it would always return a `Double`. But [DJClayworth](https://stackoverflow.com/users/19276/djclayworth) points out that the Javadocs for [`parse(String, ParsePosition)`](http://java.sun.com/javase/6/docs/api/java/text/NumberFormat.html#parse(java.lang.String,%20java.text.ParsePosition)) (which is called by `parse(String)`) say that a `Long` is returned if possible. Therefore, **casting the result to `Double` is unsafe and should not be tried!**  

*Thanks, DJClayworth!*
This should be no problem using java.text.DecimalFormat.