title: Is there a way to initiate the array only once?
body: <p>Here's my code:</p>
  <pre><code>import java.util.Arrays;
  import java.util.Scanner;
  
  
  public class User
  {
     private static int [] users;
  
     public User(){
         
              users = new int[10];
              Scanner input = new Scanner(System.in);
              int InputNumber = input.nextInt();
              int length = String.valueOf(InputNumber).length();
  </code></pre>
  <p>I have an method that calls this one, but I believe it's that everytime I do it, it creates an array, or that's what I think it does.</p>
  <p>Down here is just a bunch of code to make verifications and add the number to the array.</p>
  <pre><code>      if(length != 8 || InputNumber &lt; 0){
              System.out.println(&quot;That number isn't valid, try again, the number must have 8 digits&quot;);
              User menu = new User();
              return;
          }else{    
               int i = -1;
           do{ 
               i++;
               continue;
          }while((users[i] != 0 &amp;&amp; users[i] == InputNumber) );
              
           if(i == users.length){
              System.out.println(&quot;There's enough space, delete users&quot;);           
          }else if(users[i] != 0 &amp;&amp; users[i] == InputNumber){
              System.out.println(&quot;That user already exists&quot;);
          }else{
              System.out.println(&quot;The user &quot; + InputNumber + &quot; as been added!&quot;);
              users[i] = InputNumber;
          }  
              //show a menu
        }
      } 
  </code></pre>
  <p>There aren't any errors and I can create a user but the thing is, every time I try to create another one it looks like it creates another array, I think. What I want to know is what can I change to make this work.</p>