title: Remove element from an array (code-specific)
body: <p>The user enters x-amount of integers, which are stored in an array ('dataA'). The average of the data is calculated, and the element, which is furthest should be removed ('outlier'). I don't know how to remove the element and need to know. </p>
  
  <p>Also, the program removes one outlier, it calculates the new average and removes the next outlier until there is one element left. </p>
  
  <pre><code>public static Scanner sc1 = new Scanner(System.in);
  public static int dataN = sc1.nextInt();//number of data elements
  public static double[] dataA = new double[dataN];//array storing elements
  
  for(int index = 0; index&lt;dataA.length; index++)//increments index
      {
          double lengthA = dataA.length;//length of array
          double avg = sum/lengthA;//avg of elements
  
          double outlier = dataA[0];//outlier
          double index_outlier = 0;//index of outlier
  
          double dif_in = Math.abs(avg - dataA[index]);//difference of avg &amp; element
          double dif_out = Math.abs(avg - outlier);//difference of avg &amp; outlier
  
          if(dif_in &gt; dif_out)
          {
              outlier = dataA[index];
              index_outlier = index;      
          }
  </code></pre>