日期:2014-05-18 浏览次数:20744 次
int n = 10; StringBuilder builder = new StringBuilder(); for(int i=1;i<=n;i++){ builder.append(i); } int count = builder.toString().replaceAll("[^1]", "").length(); System.out.println(count);