title: Lottery Program Java Compare two numbers
body: <p>So basically I'm writing a lottery program using two tree sets each with 6 integers, one user inputted and another random generated. I have to compare the numbers to each other to output a prize, for example if two numbers were to match then you win 100 dollars. I'm having trouble on how to create such a method. Any help would be great thanks!</p>
  
  <p>Here is my main,</p>
  
  <pre><code>public static void main(String[] args)
  {
      Set&lt;Integer&gt;s1 = createWinningNumber();
      Set&lt;Integer&gt;s2 = getUserNumber();
  
      System.out.println("Your ticket was: "+s2);
      System.out.println("Winning numbers: "+s1);
  
  }//End of main
  public static Set&lt;Integer&gt; getUserNumber()
  {
      int set = 0;
      Set&lt;Integer&gt; number = new TreeSet&lt;Integer&gt;();
      Scanner keyboard = new Scanner(System.in);
      System.out.println("Pick your Lucky Lotto Numbers");
      System.out.print("Type 6 lotto numbers: ");
      for(int i = 0; i&lt; 6;i++)
      {
          System.out.print("");
          set = keyboard.nextInt();
          number.add(set);
      }
      return number;  
  }//End of getUserNumber
  
  public static Set&lt;Integer&gt; createWinningNumber()
  {
      Set&lt;Integer&gt; winning = new TreeSet&lt;Integer&gt;();
      Random generator = new Random();
      for(int i = 0;i&lt;6;i++)
      {
          winning.add(generator.nextInt(40));
      }
      return winning;
  }//End of createWinningNumber
  </code></pre>
  
  <p>Output so far</p>
  
  <pre><code>Pick your Lucky Lotto Numbers
  Type 6 lotto numbers: 4 12 7 35 20 1
  Your ticket was: [1, 4, 7, 12, 20, 35]
  Winning numbers: [5, 8, 19, 24, 32]
  </code></pre>