title: Comparing two integer arrays in Java
body: <p>I am trying to write code to compare two arrays. In the first array I have put my own digits, but the second the array takes numbers from the input file. The size of this array is determined by the first number in the file while the first array is always of size 10. The length must be the same for both arrays as well as the numbers.</p>
  
  <p>My code is below:</p>
  
  <pre><code>public static void compareArrays(int[] array1, int[] array2) {
      boolean b = false;
      for (int i = 0; i &lt; array2.length; i++) {
  
          for (int a = 0; a &lt; array1.length; a++) {
  
              if (array2[i] == array1[a]) {
                  b = true;
                  System.out.println("true");
              } else {
                  b = false;
                  System.out.println("False");
                  break;
              }
          }
      }       
  }
  </code></pre>