Problem in Pattern no 33 of PDF

Please help me with the logic used and detailed code that which points we have to consider while writing the code.

@discobot below is my code for Reference :

import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int nsp = n-1;
        int digit = n;
        int row = n;
        while(row > 0){
            //For spaces
        for(int i = 0; i <= nsp; i++){
            System.out.print("  ");
        }
        // for printing no. before 0
        for(int i = digit; i < n; i++){
            System.out.print(i+" ");
        }
        //Print zero 
        System.out.print("0 ");

        //for printing no. after 0
        for(int i = n-1; i >= digit; i--){
            System.out.print(i+" ");
        }
        row--;
        nsp--;
        digit--;
        System.out.println();
        }
    }
}

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

thanks for the reply can be easily understood

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.