title: How can i calculate the arithmetic mean in my code sample?
body: <p>I write a code sample about calculate the aritmetic mean,i did lots of thing but some parts are missing/incorrect.</p>
  
  <p>This is my code sample : </p>
  
  <pre><code>public static void main(String[] args) {
      int i;
      int j;
      int thelargest;
      int thesmallest;
  
      Scanner input = new Scanner(System.in);
      System.out.println("Enter the list of number : ");
      String input2 = input.nextLine();
  
      String[] numbers = input2.split("\\s+");
  
      int[] result = new int[numbers.length];
      for (j = 0; j &lt; numbers.length; j++) {
          result[j] = Integer.parseInt(numbers[j]);
  
      }
  
      for (i = 0; i &lt; result.length; i++) {
          System.out.print("");
          System.out.println(result[i]);
      }
  
      System.out.println("The Largest Number :  "
              + findTheLargestNumber(result));
      System.out.println("The Smallest Number :  "
              + findTheSmallestNumber(result));
      thelargest = findTheLargestNumber(result);
      thesmallest = findTheSmallestNumber(result);
      float arithmeticMean = (float) (result[i + j])// result.length;
              System.out.println("The Arithmetic Mean : " + arithmeticMean);
  </code></pre>
  
  <p>/*There is a mistake and  I tried to solve it but I didn't find any way to solve it.I want my programme to sum the results(numbers) and divide into number of result.(For example :10+20+30=60 and the aritmetic mean is 60/3=20.)Lastly,I think the mistake is about (float)(result[i+j]).</p>
  
  <p>*/</p>
  
  <pre><code>}
  
  public static int findTheSmallestNumber(int[] series) {
      int thesmallest = series[0];
      for (int i = 1; i &lt; series.length; i++) {
          if (series[i] &lt; thesmallest) {
  
              thesmallest = series[i];
          }
      }
      return thesmallest;
  }
  
  public static int findTheLargestNumber(int[] series) {
      int thelargest = series[0];
      for (int i = 1; i &lt; series.length; i++) {
          if (series[i] &gt; thelargest) {
  
              thelargest = series[i];
          }
      }
      return thelargest;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks for everbody which gonna help to me .</p>