Doubt in Pattern no 8 of the pdf

This is the code below that i have written but i am not able to get the desired result . Can you please help me out…

package patternsection;
import java.util.Scanner;
public class Pattern8 {

public static void main(String[] args) {
	try(Scanner scn = new Scanner(System.in)){
		int n = scn.nextInt();
		int row = 1;
		while(row <= n) {
			if(row == 1 || row ==5) {
				System.out.print("*");
				int csp1 = 1;
				while(csp1 <= n-2) {
					System.out.print(" ");
					csp1++;
				}
				System.out.print("*");
			}
			System.out.println();
			if(row > 1 && row < n) {
				if(row % 2 == 0) {
					int csp2 = 1;
					while(csp2 % 2 == 0 ) {
						System.out.print("*");
						csp2++;
					}
				}
				if(row == ((n/2)+1)){
					int csp3 = 1;
					while(csp3 < ((n/2)+1)) {
						System.out.print("");
						csp3++;
					}
					System.out.print("*");
				}
			}
			row++;
		}
	}
}

}