Interview Questions

How to print floyd's triangle in java?

Use the following code print Floyd's triangle in Java

public static void printFloydTriangle()
{
    int s = 0;
    int rowSum = 0;
    int m=1;
    for(int i=1;i<10;i++)
    {
        rowSum = (i *((i*i)+1))/2;
        for(int j=m;s<rowSum;j++)
        {
        System.out.print(j+" ");
        s=s+j;
        m=j+1;
        }
        s=0;
    System.out.println();
    }
}