Error in my code in if condition

import java.util.Scanner;

public class Pattern11 {

public static void main(String[] args) {
	Scanner scn = new Scanner(System.in);
	int n = scn.nextInt();

	for (int i = 1; i <= n; i++) {
		int k = 0;
		for (int j = 1; j <= n * 2 - 1; j++) {
			if (j >= n + 1 - i && j <= n - 1 + i && k) {
				System.out.print("*");
				k = 0;
			} else {
				System.out.print(" ");
				k = 1;
			}
		}
		System.out.println();
	}
}

}

do k==1 in the if condition