StringBuilder sbf= new StringBuilder(""); for (int i = 0; i <6 ; i++) { sbf.setLength(0); for (int j = 0; j <4 ; j++) { sbf.append(" "+(i+j)%3+" - "+j);//sbf.append(" "+(i+j)%3+"--"+(i+j)%6); } System.out.println(sbf.toString()); }
0 - 0 1 - 1 2 - 2 0 - 3
1 - 0 2 - 1 0 - 2 1 - 3
2 - 0 0 - 1 1 - 2 2 - 3
0 - 0 1 - 1 2 - 2 0 - 3
1 - 0 2 - 1 0 - 2 1 - 3
2 - 0 0 - 1 1 - 2 2 - 3app
當 i=4 j=6時ui
0 - 0 1 - 1 2 - 2 0 - 3 1 - 4 2 - 5
1 - 0 2 - 1 0 - 2 1 - 3 2 - 4 0 - 5
2 - 0 0 - 1 1 - 2 2 - 3 0 - 4 1 - 5
0 - 0 1 - 1 2 - 2 0 - 3 1 - 4 2 - 5spa