I couldn't' figure out why my code was not working, specifically it is giving me problems with the ArrayList.get(i) == ArrayList.get(i); in Java, it should return and compare the two numbers, is that not correct?
package homework.pkg9;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.JOptionPane;
public class Homework9 {
    public static void main(String[] args) {
        //Create a method that creates a random winning lottery ticket
        //Ask the user to input his 5 numbers for the winning lottery
        //Make a mthode that campares the two arrays and return the numbers that match
        //If all numbers match generate the messge "Grand Prize Winner!"
        ArrayList userArray = new ArrayList();
        ArrayList randomArray = new ArrayList();
        ArrayList finalArray = new ArrayList();
        int userPick, counter = 0;
        randomArray = lottryNumbers();
        for (int i = 1; i <= 5; i++) {
            userPick = Integer.parseInt(JOptionPane.showInputDialog("Please choose a number between 0 and 9"));
            while (userPick <= 0 || userPick >= 9) {
                userPick = Integer.parseInt(JOptionPane.showInputDialog("Sorry, please choose a number between 0 and 9"));
            }
            userArray.add(userPick);
        }
        for (int i = 1; i <= 5; i++) {
            if (userArray.get(i) == randomArray.get(i)) {
                counter++;
                finalArray.add(userArray.get(i));
            }
        }
        if (finalArray.size() == 5) {
            System.out.println("Grand Prize Winner!");
        }
        System.out.println("Sorry, /n you only got these " + counter
                + " numbers correct: /n" + finalArray);
    }
    public static ArrayList lottryNumbers() {
        ArrayList randomArray = new ArrayList();
        Random rand = new Random();
        for (int i = 1; i <= 5; i++) {
            randomArray.add(rand.nextInt(10));
        }
        return randomArray;
    }
}
 
     
    