Write a Java program to print following number pyramid.

Print Number Pyramid in Java

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 = 1;
   
        for (int i = noOfRows; i > 0; i--)
        {
            //Printing i spaces at the beginning of each row
            for (int j = 1; j <= i; j++)
            {
                System.out.print(" ");
            }
 
            //Printing number value 'rowCount' and add space after every number of row
            for (int j = 1; j <= rowCount; j++)
            {
                System.out.print(rowCount+" ");
            }
 
            //Go to next line after every row
            System.out.println(); 
            rowCount++;
        }
    }
}