Conformation code for pattern33

Below is the code that i have written for pattern 33, and i got output for it, can u guide me whether it is ok or can i still optimize it?

import java.util.Scanner;

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

	int rows = n;
	int nst = 1;
	int nsp= n - 1;
	int val;

	while (rows >= 1) {
		val=rows;
		
		for(int csp=1;csp<=nsp;csp++)
			System.out.print(" "+" ");
		
		for(int cst=1;cst<=nst;cst++) {
			if(cst==n)
				System.out.print("0"+" ");
			else {
				if(cst<=nst/2) {
					System.out.print(val+" ");
					val++;
				}
				else if(cst==nst/2+1)
					System.out.print("0"+" ");
				else {
					val--;
					System.out.print(val+" ");
				}
			}
		}
		
		System.out.println();
		nst+=2;
		nsp--;
		rows--;
		
		}
		
		
	}

}

hello @Lalit2142 your code is working fine no need for optimization

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.