Java Program to Print Pyramid of Numbers in Reverse Order

Java Program to Print Reverse Pyramid of Numbers

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class NumberPyramid
{
    public static void main(String[] args) throws NumberFormatException, IOException
    {
        System.out.print("How many rows You want in your Pyramid:");
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int noOfRows = Integer.parseInt(br.readLine());
        int rowCount = noOfRows;
   
        for (int i = noOfRows; i >= 1; i--)
        {
            //Printing i * 2 spaces at the beginning of each row
            for (int j = 1; j <= i * 2; j++)
            {
                System.out.print(" ");
            }
 
            //Printing j value where j value will be 1 to rowcount and add space after every number
            for (int j = i; j <= noOfRows; j++)
            {
                System.out.print(j+" ");
            }
            
            //Printing j value Printing j where j value will be from i to noOfRows and add space after every number
            for (int j = noOfRows-1; j >= i; j--)
            {
                System.out.print(j+" ");
            }
 
           //Go to next line after every row
           System.out.println(); 
           rowCount++;
        }
    }
}