title: Finding a minimum and maximum value in an array
body: <p>So I'm trying to find a min and max of an array which are put in by the user.</p>
  
  <p>This is my code</p>
  
  <pre><code>public static void main(String[] args) {
  
      int[] a = new int[args.length];
      for (int i = 0; i &lt; args.length; i++) {
          a[i] = Integer.parseInt(args[i]);
          int max = a[0];
          for (int j = 1; j &lt; args.length; j++) {
              if (a[j] &gt; max) {
                  max = a[j];
              }
          } 
          System.out.println("the maximum value of the array is " + max);
      }
  }
  </code></pre>
  
  <p>But the output I am getting is every single number I have put in. What is my mistake here?</p>