title: Output text in Java shifted half a space
body: <p>I am trying to horizontally display matrices of different sizes.
  I'm using a the BlueJ terminal window for my output.
  Printing the matrices works if the matrix on the left has more rows than the ones that follow, however when it has less rows the following matrices are out of alignment. Pictures below.</p>
  
  <p><a href="https://i.stack.imgur.com/k5sPC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k5sPC.png" alt="current output"></a></p>
  
  <p>An obvious solution might be to get rid of one space that comes before the second matrix (after the first matrix has ended), but this yields the following result:</p>
  
  <p><a href="https://i.stack.imgur.com/VTkak.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VTkak.png" alt="alternate output"></a></p>
  
  <p>Code used to produce spacing before rows of the second matrix:</p>
  
  <pre><code>System.out.printf("%"+Integer.toString((width*numElements) + (numElements+4)) + "s", " ");
  </code></pre>
  
  <p>Where <code>width</code> is equal to the length of the largest value in the matrix and <code>numElements</code> is equal to the number of elements in each row of the matrix.</p>
  
  <p>How do align these matrices correctly?</p>
  
  <p>Thank you in advance!</p>