二次元配列とday of week うるう年を取得するleep yearを使いその月のカレンダーを表示させるプログラムを作っているのですが綺麗に並べることができません
綺麗に表示する方法を教えてほしいです
###java
###ソースコード
import java.io.*;
public class sample68
{
public static void main (String[] args)throws IOException
{
System.out.println("西暦年を入れてください");
BufferedReader br=
new BufferedReader(new InputStreamReader(System.in));
String str = br.readLine();
int yy = Integer.parseInt(str);
System.out.println("月を入力してください"); str = br.readLine(); int mm = Integer.parseInt(str); day_of_week obj1 = new day_of_week(); int wk = obj1.youbi(yy,mm,1); int tuki_max =31; switch (mm){ case 2: leap_year obj2 = new leap_year(); tuki_max = obj2.uruudosi(yy); break; case 4: case 6: case 9: case 11: tuki_max =30; break; } int cnt_day = 1; System.out.println("日\t月\t火\t水\t木\t金\t土"); int[][] cal_tbl = new int[6][7];
//カレンダー配列の初期化
int i;
int j;
for(i=0; i<6; i++){
for(j=0; j<7; j++){
cal_tbl[i][j] = 0;
}
}
for(i=0; i<6; i++){
for(j=0; j<7; j++){
if(i==0){
if(j> wk-0){
cal_tbl[i][j] =cnt_day;
cnt_day = cnt_day+1 ;
}
}
else if(cnt_day<tuki_max){
cal_tbl[i][j] =cnt_day;
cnt_day = cnt_day +1;
}
}
}
for(i=0; i<6; i++){ for(j=0; j<7; j++){ if(cal_tbl[i][j]==0){ System.out.println(" " + "\t");
}else{
System.out.print(cal_tbl[i][j] +"\t");
}
}
}
}
}
day_of_week
import java.util.Date;
import java.util.Calendar;
class day_of_week{
//フィールド int youbi(int yy,int mm,int dd){ //メソッド //現在日付設定 Date today = new Date();//現在日取得 //Calendarクラスオブジェクト生成 Calendar cal = Calendar.getInstance(); //現在日付設定 cal.setTime(today); cal.set(Calendar.YEAR,yy); cal.set(Calendar.MONTH,mm-1); cal.set(Calendar.DATE,dd);
int wk = cal.get(Calendar.DAY_OF_WEEK);
return wk; }
}
class leap_year
{
int dim;
int uruudosi(int yy){
if ((yy % 4 == 0 && yy % 100 != 0) || yy % 400 == 0){
dim = 29;
}else{
dim=28;
}
return dim;
}
}
試したこと
どこをどうすればいいかわからないです
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。