@Test public void a(){ t4(4); } public void t4(int c){ StringBuffer s=new StringBuffer(); StringBuffer ss=new StringBuffer(); for (int i=1;i<=c*c;i++){ s.append(i); s.append("*"); if (i==c*2){ ss=new StringBuffer(s.deleteCharAt(s.length()-1)); s.delete(0,s.length()); }else if (i%c==0){ s.deleteCharAt(s.length()-1); System.out.println(s); s.delete(0,s.length()); } } System.out.println(ss); }
09-05
485