DecimalFormat variable group size
问题 I've researched the subject somewhat before posting the question, but I couldn't find the answer. Here is what I'm trying to do: input: a number 7-8 decimal spaces long (no fractions). output: "X XXXXXX X" where X is a digit, must be present. example: 1234567 => 0 123456 7 What I tried: DecimalFormatSymbols group = new DecimalFormatSymbols(); group.setGroupingSeparator(' '); DecimalFormat idFormat = new DecimalFormat("0,000000,0", group); But this prints something like "0 1 2 3 4 5 6 7"