Write a java program to print a tringle pyramid

This program is print a tringle pyramid like 

                    1
                   222
                  33333
                 4444444
                555555555
               66666666666
              7777777777777
             888888888888888
            99999999999999999

public class PrintPyramid
{
public static void main(String as[])
{
int n=Integer.parseInt(as[0]);
int space=20;int star=1;
for(int i=1;i<=n;i++)
{

for(int x=0;x<space;x++)
{
System.out.print(" ");
}


for(int x=0;x<star;x++)
{
System.out.print(i);
}
for(int x=0;x<star-1;x++)
{
System.out.print(i);
}
System.out.print(" ");

space=space-1;
star=star+1;
System.out.println(" ");
}
}
}

Output:
                    1
                   222
                  33333
                 4444444
                555555555
               66666666666
              7777777777777
             888888888888888
            99999999999999999