import java.text.DecimalFormat;
public class FormatTest {
public static void main(String[] args) {
DecimalFormat df = new DecimalFormat("0.0");
System.out.println(df.format(10.4)); // prints 10,4 instead of 10.4
System.out.println(df.format(100.5)); // prints 100,5 instead of 100.5
System.out.println(df.format(3000.3));// prints 3000,3 instead of 3000.3
}
}
The output of my code above is below with a comma as decimal separator while normally it should be with a point. I use NetBeans 12.5 with Maven.
It seems like Java uses my local decimal separator instead of point. Also, I need to force point (".") as the only separator.
--- exec-maven-plugin:3.0.0:exec (default-cli) @ FormatTest ---
10,4
100,5
3000,3