Use grouping to display a number
import java.text.NumberFormat;
public class Main {
public static void main(String args[]) {
NumberFormat nf = NumberFormat.getInstance();
System.out.println("Default format: " + nf.format(1234567.678));
nf.setGroupingUsed(false);
System.out.println("Format without groupings: " + nf.format(1234567.678));
}
}
/*
Default format: 1,234,567.678
Format without groupings: 1234567.678
*/
Related examples in the same category