I am trying to compare an array user_correct[] if it has a 0 it hasnt been used if it has a 1 it has. However it is not registering my if statements.
import java.util.Random;
import java.io.*;
public class Lottery
{
public static void main (String[] args) throws IOException
{
BufferedReader in = new BufferedReader (new InputStreamReader (System.in));
int user_nums[] = new int[3];
int winner[] = new int[3];
int user_correct[] = new int[3];
int choice=0;
int num_correct =0;
int numsets=0;
Random generator = new Random();
System.out.println("Welcome to Ken's Programming Education Lottery!");
do{
System.out.println("Please select an option:");
System.out.println("1 - Choose my own lottery numbers");
System.out.println("2 - Have the computer generate my numbers");
choice= Integer.parseInt(in.readLine());
//fills in the ticket numbers if user wants to pick them
if (choice==1)
{
for (int i=1; i<4; i++){
do{
System.out.println("Please enter a value between 1 and 50 for number " + i + " on your ticket:");
user_nums[i-1]=Integer.parseInt(in.readLine());
}
while(user_nums[i-1]>50 || user_nums[i-1]<1);
}
}else if (choice==2){
for (int i=0; i<3; i++){
user_nums[i]=generator.nextInt(50)+1;
}
}
}while(choice!=1 && choice!=2);
// do while to get out when the lottery ticket is a total winner
do{
for (int i =0; i<3; i++){
winner[i]=generator.nextInt(50)+1;
user_correct[i]=0;
}
num_correct=0;
numsets++;
//loop to compare the current winning numbers and the user picked numbers
for (int j=0; j<3; j++){
for (int k=0; k<3; k++){
if (user_nums[k]==winner[j]){
if (user_correct[k]==0){
user_correct[k]=1;
num_correct++;
// if (num_correct==2){
//for (int u =0; u<3; u++){
// System.out.print (""+user_correct[u]+" ");
// System.out.print (""+winner[u]+" ");
// }
//}
}
}
}
}
}while(num_correct <3);
System.out.println("Your lottery numbers are:" + user_nums[0] + " " + user_nums[1] + " " + user_nums[2] + " "/* + user_nums[3] + " " + user_nums[4] +""*/);
System.out.println("Lottery numbers were:" + winner[0] + " " + winner[1] + " " + winner[2] + " "/* + winner[3] + " " + winner[4] +""*/);
System.out.println("Winner!It took " + numsets + " tries to win the lottery!");
}
}