Inserting int in array mid position
<p>The task is to create a 20-element <code>int</code> array and fill it with random integers from index 0 to index 18. Then I would like to insert -1 in the middle and print the entire array. There is something wrong with my code, though.</p>

<pre><code>import java.util.Random;

public class Zadanie5_3{

    public static void main(String[] args){

        Random rand = new Random();
        int[] tab = new int[20];

        for(int i = 0; i &lt;= 18; i++){
            tab[i] = rand.nextInt();
        }   

        for(int j = 19; j &gt; tab.length/2; j--){
            tab[j] = tab[j--];
            tab[tab.length/2] = -1; 

            System.out.println(tab[j]); 
        }

    }   

}
</code></pre>