title: Rotating a String or char clockwise by 90 degrees
body: <p>Folks, I'm having a really hard time with rotating a Shape clockwise by 90 degrees. I'm having troubles with completing it. If there is a shape:</p>
  
  <pre><code>.t.
  ttt
  </code></pre>
  
  <p>The method <code>rotateBy90()</code> rotates the above shape by 90 degrees clockwise, so it'll be the following output:</p>
  
  <pre><code>t.
  tt
  t.
  </code></pre>
  
  <p>THe shapes are of a <code>String</code> type. 
  Here what I have and Im pretty sure Im completely doing it wrong. The method can be done by using either <code>char[][]</code>, or <code>char[]</code>, or <code>String[]</code>, or <code>String[][]</code>. Another issue is that <code>rotateBy90()</code> is a <code>void</code> method. COuld smb please help me with this rotation algorithm? Thanks in advance!</p>
  
  <pre><code>import java.util.*;
  
  public class CreateShape {
  
      private int height;
      private int width;
      private char dc;
      private Rotation initialPos;
      private Rotation nextPos;
      private char[][] shape = new char[height][width]; 
      String[] shapeLayout = new String[height];
      String[] rotatedArray;
  
  public CreateShape(int height, int width, char dc)
      {
          this.height = height;
          this.width = width;
          this.dc = dc;
          initialPos = Rotation.CW0;
      }
  
      public void rotateBy90() 
      {
          nextPos = initialPos.next();
  
          String newLayout = "";
  
          int count = 0;
          String[] newMatrixColumns= shape.split("\n");
          while (count &lt; shape.split("\n")[0].length()) {
              for (int i = newMatrixColumns.length - 1; i &gt; -1; i--) {
                  newLayout += newMatrixColumns[i].charAt(count);
              }
  
              newLayout = newLayout + "\n";
              count++;
          }
  
      }
  </code></pre>