title: How to write an array without length
body: <p>I'm trying to write a program that looks for three numbers in array that gives an arithmetic sequence of length three - three numbers a,b and c form an arithmetic sequence of length 3 if: b-a = c-b.</p>
  
  <p>I have 2 problems:</p>
  
  <ol>
  <li><p>I need to read an arbitrary number type int, and put them inside an array. for example: java string 3 4 5 6, gives array: [3],[4],[5],[6].
  and I couldn't do it because when creating an array it asks for the array length.</p></li>
  <li><p>I guess I have a problem when writing the math command for <code>b-a = c-b</code>.</p></li>
  </ol>
  
  <p>.</p>
  
  <pre><code>public static void main (String[] args) {
  
      int [] a = new int [10];
      for (int i = 0; true; i++) {
        a[i] = Integer.parseInt(args[i]);
      }
  
      System.out.println(a.length);
      for (int i = 0; i &lt; a.length; i++) {
  
        for (int j=i+1; j&lt;a.length; ++j) {
          int sum = a[i]-a[j];
          int tempa = a[i];
          int d = a[i+1];
          int c = a[i+2];
          if (d == tempa+d &amp;&amp; c == tempa +  2*d)
              System.out.println("yes");
  
          }
       }
  }
  </code></pre>