We have to make a method called printStarLinesDecreasing that has two integer parameters m and n and prints 2*m-1 lines. The first line has n * characters, the next one n+1, and so on until the mth line has n+m-1, the (m+1)th line has n+m-2 and so on until the last one has n * characters.

ex: if the parameter m is 3 and n is 5, then it prints:

*****

******

*******

******

*****

I already wrote the code for making it increase from 3 to 5, but I can't get it to go from 5 to 3.

Here's my code:

Code: Select all

`public void printStarLines (int m, int n)//prints n lines of m * characters increasing 1 each line`

{

for(int i = 1; i <= n; i++, m++)

{

printStars(m);

System.out.println("");

}

}

The other method is a method called isPowerOfTwo that has an integer parameter n and returns true if n is a power of 2, false otherwise. I have no idea how to even go about doing this haha.

Any help would be very much appreciated