I do not think you can do this with DecimalFormat , because your spaces are not group or decimal separators.
A simple way would be to simply use a string:
int number = 8392472; String s = String.valueOf(number); String formatted = s.substring(0, 3) + " " + s.substring(3, 5) + " " + s.substring(5, 7);
source share