-1

When I format a double number it returns me with a comma, but I need it to return with a period. By the way I'm with the IDE NetBeans

double importe = (catidad * precioUnit);
System.out.println("double : " + importe);

System.out.println("double : " + String.format("%.2f", importe));

System.out.format("double : %.2f", importe);

returns:

run:
double : 5.699999999999999

double : 5,70

double : 5,70

I want you to return me with a point

leonardkraemer
  • 6,573
  • 1
  • 31
  • 54
Elvis
  • 1

1 Answers1

1

that depends on the local formatting

Locale.setDefault(Locale.US);
System.out.println(String.format(Locale.US, "%f", 3.141592));
Jamal Alkelani
  • 606
  • 7
  • 19