Doubt in pattern no 8 of pdf

Please help me with the code and the logic used for the formation of above pattern.

@discobot Refer my code : (Note this question is only designed for Odd Numbers i.e. only do this question for when n is odd.)

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
	// TODO Auto-generated method stub
	Scanner scn = new Scanner(System.in);
	int n = scn.nextInt();
	
	//initializing variables
	
	int nsp=n-2;
	int nsp2=0;
	
	for(int rows=1; rows<=n; rows++) {
		for(int csp2=1; csp2<=nsp2; csp2++) {
			System.out.print("  ");
		}
		
		System.out.print("* ");
		
		for(int csp=1; csp<=nsp;csp++) {
			System.out.print("  ");
		}
		
		
		
		if(n%2==0 && rows!=n/2) {
		System.out.print("* ");
		}
		
		if(n%2!=0 && rows!=(n+1)/2) {
			System.out.print("* ");
		}
		//prep
		System.out.println();
		if(rows<=n/2) {
			nsp-=2;
			nsp2+=1;
		} else {
			nsp+=2;
			nsp2-=1;
		}
	}
	
	
	
	
	
	scn.close();
}
}

Hi! To find out what I can do, say @discobot display help.