title: How to find the greatest number of negative integers in array in java?
body: <p>How to find the most significant number of negative integers in java? I have the following code and work well with positive integers. This is the code:</p>
  <pre><code>int max = 0; // not initialsing it also makes it 0
  int[] n = {-1,-2,-3,-4};
  for(int i = 0; i &lt; n.lenght; i++)
     if(max &lt; n[i]) 
        max = n[i];
  </code></pre>
  <p>Now, I can solve it by reducing the <code>max</code> variable to <code>-5</code> or something below <code>-4</code>, but this is inefficient because we don't know the lowest value.</p>
  <p>So, how can it be achieved?</p>