Q:

Print what percent of numbers are even and print out even numbers in the array

I'm recently learning arrays, and I am stuck on this question. 
I basically have to ask the user to input the numbers that will go into the array, and have to print out the percent of the numbers even and have to print all even numbers in the format that follows. 
Even values are : 89,22,-8, 0

My code is this
import java.util.*;

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

        Scanner input = new Scanner(System.in);

        System.out.println("How many numbers in the array?");
        int num = input.nextInt();
        int count=0;
        int count1=0;

        for (int i=1; i<=num; i++) {

            System.out.println("Enter an integer: ");
            count++;
            int integer= input.nextInt();
            if(integer%2==0) {

                int list[]=new int[integer];
                count1++;
            }
        }

        System.out.println("There were "+((double)count1/count)*100+" percent of even numbers.");
        System.out.println("Even values are "+Arrays.toString(list)+"");

    }
}

This code ends up with an error message, saying "list" is not initialized. 
I know that because "list" is inside the for loop, the system doesn't realize that it has been initialized, but I have no idea how to have the system recognize "list".
Any help or comments are appreciated. :)

A:

package com.inlet.ifserver;

import java.util.*;

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

        Scanner input = new Scanner(System.in);

        System.out.println("How many numbers in the array?");
        int num = input.nextInt();
        int count1 = 0;

        Integer[] evens = new Integer[num];

        for (int i = 0; i < num; i++) {

            System.out.println("Enter an integer: ");
            int integer = input.nextInt();
            if (integer % 2 == 0)
                evens[count1++] = integer;

        }

        evens = Arrays.copyOfRange(evens, 0, count1);

        System.out.println("There were " + ((double) count1 / num) * 100 + " percent of even numbers.");
        System.out.println("Even values are " + Arrays.toString(evens) + "");

    }
}

