Positive and negative numbers with ArrayList
<p>How do I seprate positive and negative numbers? I have this code:</p>

<pre><code>import java.util.ArrayList;
import java.swing.JOptionPane;

public class Test {
    public static void main(String[] args) {
        ArrayList al = new ArrayList();

        int num=Integer.parseInt(JOptionPane.showInputDialog("How many numbers?"));
        for (int i=0 ; i &lt; num ; i++) {
            al.add(Integer.parseInt(JOptionPane.showInputDialog("What numbers?")));
        }
    }
}
</code></pre>

<p>Let's say I want to add 5 numbers. <code>-2, -7, 8, 4, -1</code></p>

<p>I need the output to be <code>Positive = 8, 4</code>  and <code>Negative = -2, -7, -1</code></p>