title: How can I check number present or not in Java
body: <p>I have to display that given number present in array or not.
  <strong>For example:</strong></p>
  
  <pre><code>int[] number1 = {2,3,6,14,23,8,23,19};   
  int[] numbers2 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30};
  </code></pre>
  
  <p>Now I have to check whether number1 array element present in number2 array or not if yes then print present number.
  So how can I achieve this in Java?</p>
  
  <p>My code:</p>
  
  <pre><code>int[] number1 = {2,3,6,14,23,8,23,19};   
      int[] numbers2 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30};
  
  for(int i=0; i&lt;number2.length;i++){
      for(int j =0; j&lt;number1.length:j++){
          if(number2[i]==number1[j]){
              System.out.println("present number is:"+number1[i]);
          }
      }
  }
  </code></pre>