Correct this Inverted hour glass code

Please explain the next steps
import java.util.*;
public class Main {
public static void main(String args[]) {

 Scanner scn=new Scanner(System.in);
 int N = scn.nextInt();
 int nr = (2*N)+1;

 int nst1=1;
 int nsp=(2*N)-1;
 int nst2=1;

 for (int row=1;row<=nr;row++)
 {
	 for (int cst=1;cst<=nst1;cst++)
	 {
		 System.out.print("*");
	 }
	for (int csp=1;csp<=nsp;csp++)
	{
		System.out.print(" ");
	}
	for (int cst=1;cst<=nst2;cst++)
	{
		System.out.print("*");
	}
    
	if(row <= (nr/2)+1)
	{
           nst1=nst1+1;
		   nsp = nsp-2;
		   nst2=nst2+1;

	}
	else {
		 nst1=nst1-1;
		 nsp=nsp+2;
		 nst2=nst2-1;

	}
	System.out.print("\n");
 }
 


}

}