How can I create a 20-element integer array and let the user populate it?

I tried the following: 

```
    import java.util.*;

    class Selection{
    public static void main(String[] args){

    int x = 0;
    int y = 0;
    int a [] = new int [x];
    Scanner in = new Scanner (System.in);

    while(a.length<21){
        System.out.print("Enter element number  " + (y+1) + " : ");
        x = in.nextInt();
        y++;
    }

    System.out.println(a);
    }
    }

```