Im getting right pattern but my one test case is failed why?

import java.util.*;
public class Main {
public static void main(String args[]) {
// Your Code Here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();

	int nst = n;
	int row = 1;
	while(row<=n){
		int cst=1;
		while(cst<=nst){
			
			if(row==1||row==n){
				System.out.print("*    ");
			}
			else if(row==n/2+1){
				if(cst==1||cst==nst){
					System.out.print("*    ");
				}
				else{
					System.out.print("     ");
				}
			}
			else{
				if(cst==nst/2+1){
					System.out.print("     ");
				}else{
					System.out.print("*    ");
				}
			}
			
			cst++;
			
			}
		System.out.println();
		row++;
	}
}

}