title: Java bubble sort print each sorted line
body: <p>I have my bubble sorting algorithm which works correctly but I want to set it up so it prints each line in the process of the final output. I have tried some <code>if</code> statements and <code>for</code> loops to print out each line of sorting but I can't seem to get exactly what I am trying to do. Here is my code</p>
  
  <pre><code>// If bubble sorting is selected here is the code
       if(sortRunner == 1) {               
         int swap; 
         for(int i = 0; i &lt; list.length - 1; i++) {
             for(int j = 0; j &lt; list.length - i -1; j++){             
                  if(list[j] &gt; list[j+1]){
                      swap = list[j];
                      list[j] = list[j+1];
                      list[j+1] = swap;
  
                  }
              }
           }
           System.out.print("\nThe bubble sort from the numbers are: ");
           for (int k = 0; k &lt; list.length; k++){
              System.out.print(list[k] + " ");
           }
           System.out.println();
       } // End bubble sorting here
  </code></pre>