i need to compare these two arrays. one array in the lottotest class, method getdata gets the users numbers and stores them in an array. the nest in loto class, method gendata, generates 6 random numbers between 1-9. i need to then call both methods into the main method and compare them. please help

import javax.swing.JOptionPane;
import java.util.ArrayList;
class lottotest
{
  public static void main(String[]args)
  {
    final int numbers = 5;    
    double[] yourNumbers = new double[numbers];
    getdata(yourNumbers);
   
  }
  
  public static void blnResult(Double[] lotoNumbers)
  {
    getdata(double[] yourNumbers);
    boolean blnResult = ArrayList.equals(lotoNumbers, yourNumbers); 
      System.out.println("Are two int arrays equal ? : " + blnResult);
     
      }
  
    private static double getdata(double[] array) 
    {
      String input;
      
      for (int i = 0; i < array.length; i++)
      {
        input = JOptionPane.showInputDialog("Enter " +
                                 "your numbers 1-9 " + (i + 1) + ".");
        array[i] = Double.parseDouble(input);
        
      }
      return input;
    }
    }

.................................

import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;

public class Loto 
{
  
  private static int gendata(double[] array)
  {
    ArrayList<Integer> lotoNumbers = new ArrayList<Integer>();
    for(int i = 1; i <= 8; i++)
      lotoNumbers.add(i);
    Random ran = new Random();
    
    for(int i = 0; i < 5; i++) 
    {
      int x = lotoNumbers.remove(ran.nextInt(lotoNumbers.size()));
      System.out.print(" " + x);
      
    }
    lottotest.blnResult(lotoNumbers);
  }
    
  }

yeah i need to make the equal, because it is a lotto program so i am testing to find a winner. 6 elements in common. 1-9

This article has been dead for over six months. Start a new discussion instead.