Printing spaces to align numbers according to my pyramid pattern
<p>It sounds a lot easier than it looks. Basically I have my code finished this is my output where the leading number is whatever integer the program receives as input. In this case n = 5:</p>

<pre><code>    1
   21
  321
 4321
54321
</code></pre>

<p>but this is what it is suppose to look like:</p>

<pre><code>        1
      2 1
    3 2 1
  4 3 2 1
5 4 3 2 1
</code></pre>

<p>How should I go about adding spaces in between my numbers while maintaining this pattern? I've tried editing here and there but it keeps coming out like this: </p>

<pre><code>    1
   2 1
  3 2 1
 4 3 2 1
5 4 3 2 1
</code></pre>

<h3>My code:</h3>

<pre><code>import java.util.Scanner;

public class DisplayPattern {
   public static void main(String[] args)
   {
      Scanner input = new Scanner(System.in);
      System.out.print("Enter an integer and I will display a pattern for you: ");
      int n = input.nextInt();
      displayPattern(n);
   }

   public static void displayPattern(int n) {
      final int MAX_ROWS = n;
      for (int row = 1; row &lt;= MAX_ROWS; row++) { 
         for (int space = (n - 1); space &gt;= row; space--) {
            System.out.print(" ");
         }

         for (int number = row; number &gt;= 1; number--) {
            System.out.print(number + " "); /*&lt;--- Here is the edit.*/
         }
         System.out.println();
      }
   }
</code></pre>

<p>Edit:
@weston asked me to display what my code looks like with the second attempt. It wasn't a large change really. All i did was add a space after the print statement of the number. I'll edit the code above to reflect this. Since it seems that might be closer to my result I'll start from there and continue racking my brain about it.</p>