Refer to this:
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html for some of the terms used below.
A couple of things. First,
10 - 2 = 8
18 - 10 = 8
26 - 18 = 8
So, while the formula (8*i)-6 you used for the termination clause works, it seems more complicated than it needs to be.
This is just a guess but if the point of the exercise was to use the increment clause of the for-loop header to control how much you increment the loop variable by, then you missed the point. I believe another point of the problem was to have you use a initial value other than the usual
0. Sure, you used
1 as the initial value for your loop variable but I don't think that was the intent. Again, this is just conjecture on my part but for a beginner type exercise, it makes more sense to me if the intent was to have you start with the first value in your progression (2, 10, 18, 26). Were you given an example related to this that maybe showed you how to use a for-loop to count by 2's or 5's? Like so:
Second, your logic for counting the number of spaces is wrong. It might help to visualize what you're trying to do, like so:
............**
........**********
....******************
**************************
Each dot (.) above represents a space you need to print to get the proper pyramid shape you want. You need to calculate how many spaces you print for each corresponding number in the progression. Your current for-loop to print spaces won't do it.
Were you already taught that for-loops can have multiple loop variables and increments? Like so:
If you were already taught this, I think applying this concept is the whole point of this exercise.