Question: I have a double value which needs to be formatted 

```
NumberFormat dft = NumberFormat.getInstance(); 
dft.setMaximumFractionDigits(3);
dft.setRoundingMode(RoundingMode.UP);
Double n= Double.parseDouble(dft.format(xyz)); //1,733.211

```

I cannot format it because it has "," in it so how to remove it from `n`.

Answer: 
You need to use `parse` method of `NumberFormat` class to parse the number first (if you want to have numeric value), e.g.:

```
Number number = NumberFormat.getNumberInstance().parse("1,733.211");
System.out.println(number);

```

Once done, you can format it:

```
NumberFormat dft = NumberFormat.getInstance(); 
dft.setMaximumFractionDigits(3);
dft.setRoundingMode(RoundingMode.UP);
System.out.println(dft.format(number));

```
Assuming xyz is a String and you just want to remove the comma:

```
Double n= Double.parseDouble(dft.format(xyz.replaceAll("[^0-9.]", "")));

```