title: The searchValue method array come out all is 0
body: <p>The part in the <code>searchValue</code> method array come out all is 0, I tested the <code>randomFill</code> method on other class come out the value is not all 0, maybe there is some error in the way I pass those array to other method.</p>
  
  <pre><code>public class test1 {
  
      //variable to use in other method
      private static int anArray[] = new int[20];
      private static int userNumber[] = new int[20];
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
  
          Scanner scanner = new Scanner (System.in);
  
          //get number to check in array
          for (int i = 0; i &lt; userNumber.length; i++) {
              System.out.print("Enter number to check " + (i+1) + " : ");
              userNumber[i] = scanner.nextInt();
          }
  
          //print out final result
          searchValue(anArray, userNumber);
  
      }
  
      // generate random number
      public int[] randomFill(){
            for(int i = 0; i &lt; anArray.length; i++){ 
                anArray[i] = (int)(Math.random() * (20-1)+ 1);
            }
  
            return anArray;
          }
  
      //compare to the array does the input number match
      public static int[] searchValue(int[] randomFill, int[] userNumber){
          for(int i = 0; i &lt; anArray.length; i++){
              if(anArray[i] == userNumber[i]){
                  System.out.println("Number exist ");
                  return anArray;
              }else{
                  // this is to check my array number, find out all is 0, will remove is once is done
                  System.out.println(anArray[i]);
              }
            }
          System.out.println("Number do not exist ");
          return anArray;
          }
  }
  </code></pre>