title: Pattern Recognition
body: <p>So my code is done, but now I need it to print out wether the chosen numbers are equal or not!</p>
  
  <p>I've made a loop for FALSE / NUMBERS ARE EQUAL, but it doesn't work properly.
  Hope you can help.
  My code looks like this:</p>
  
  <pre><code>package patternrecognition;
  
  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.TreeMap;
  
  public class PatternRecognition {
  
      public static void main(String[] args) throws Exception {
  
  
  
          BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  
  
          int AntalNumre = -1;
  
          boolean Gyldignummer = false;
          while (Gyldignummer == false) {
              System.out.print("\n\nIndtast antal numre: ");
  
              String numre = reader.readLine().trim();
  
              Gyldignummer = validInteger(numre);
  
              if (Gyldignummer == false) {
                  System.out.println("Indtast et gyldigt nummer");
              } else {
  
                  AntalNumre = Integer.parseInt(numre);
              }
  
          }
  
  
          HashMap vaerdier = new HashMap();
  
          for (int i = 0; i &lt; AntalNumre; i++) { //Studerendes nummer(i+1)
  
              boolean GyldigNummer2 = false;
  
              while (GyldigNummer2 == false) {
                  System.out.print("\n\nIndtast en vaerdi for nummer " + (i + 1) + ": ");
  
                  String vaerdi = reader.readLine().trim();
                  int vaerdien = -1;
  
                  GyldigNummer2 = validInteger(vaerdi);
                  if (GyldigNummer2 == false) {
                      System.out.println("Indtast et gyldigt nummer");
                  } else {
  
                      vaerdien = Integer.parseInt(vaerdi);
                  }
                  vaerdier.put(vaerdi, new Integer(vaerdien));
              }
          }
  
  
  
          TreeMap SorteretNummer = new TreeMap(vaerdier);
  
          Iterator nr = SorteretNummer.keySet().iterator();
  
          System.out.println("\n\n\n\n\n");
          System.out.println("Numre valgt:");
          System.out.println("------------");
  
  
          while (nr.hasNext()) {
  
              String navn = (String) nr.next();
  
  
              int numre = ((Integer) SorteretNummer.get(navn)).intValue();
  
              System.out.println("" + numre);
  
              if (numre != numre) {
                  System.out.println("FALSE");
              }
              else {
                  System.out.println("ALLE THE NUMBERS ARE EQUAL");
              }
  
          }
      }
  
      public static boolean validInteger(String nummer) {
          boolean validInteger = false;
  
  
          try {
              Integer.parseInt(nummer);
              validInteger = true;
          } catch (NumberFormatException nfe) {
              validInteger = false;
          }
          return validInteger;
  
      }
  }
  </code></pre>