//求a+aa+aaa+aaaa+...的值 public static void add(int x){ int t = 0,s = 0;String str = null; for (int i = 1; i <= x; i++) { t = t*10+x; s = s+t; str =str + t+"+"; } System.out.print(str.substring(4,str.length()-1)+"="+s); }