title: Print a text pattern in java
body: <p>I need the pattern to be printed in the form</p>
  
  <pre><code>   ABCDEF FEDCBA
     ABCDE   EDCBA
     ABCD     DCBA
     ABC       CBA
     AB         BA
     A           A
  </code></pre>
  
  <p>Below is my code :</p>
  
  <pre><code>   public static void main(String args[])
  {
      char[] c = {'A','B','C','D','E','F','G'};
      int i, j;
  
      for(j = 5; j &gt;= 0; j--)
      {
          for(int k = 0; k &lt;= j; k++)
          {
              System.out.print(c[k]);
          }
          for(i = j; i &gt;= 0; i--)
          {
              System.out.print(c[i]);
          }
  
          System.out.println();
      }
  }
  </code></pre>
  
  <p>Which gives me the output as </p>
  
  <pre><code>   ABCDEFFEDCBA
     ABCDEEDCBA
     ABCDDCBA
     ABCCBA
     ABBA
     AA
  </code></pre>
  
  <p>It was fairly easy to reach to this output. However, i haven't been able to provide spaces. I know the loop to produce the space will come in between both the for loops but i couldn't figure out how to do it. Its bugging me for a while.</p>