title: Square Array Program
body: <p>Using java, I am supposed to create a program that stores the square of the numbers 0, 1, 2 &amp; 9 in an <code>ArrayList</code> of 10 elements. </p>
  
  <p>I have created part of the code that displays the numbers and its squares but  the program goes straight down with all the numbers and does not look organized. Can someone help me write it out like like this instead:</p>
  
  <p>number: 0 square: 0</p>
  
  <p>number: 1 square: 1</p>
  
  <p>number: 2 square: 4</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>public static void main(String[] args) {
      int[] temp = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  
      for (int value : temp) {
          System.out.println(value);
      }
  
      for (int i = 0; i &lt; temp.length; i++) {
          temp[i] = (int) Math.pow(temp[i], 2);
      }
  
      for (int value : temp) {
          System.out.println(value);
      }
  }
  </code></pre>