用DecimalFormat格式化数字吧 String str = "1234567890"; DecimalFormat df = new DecimalFormat("#,###"); System.out.println(df.format(Double.parseDouble(str)));结果1,234,567,890
思路:循环字符串 从右开始 n%3 取模 =0 就设为, 明白了么