Array index out of bounds exception
<p>I am brand new to Java and was given this piece of code, no explanation just figure it out.  Im getting the basics but Im not sure why the error is in place.  Im getting </p>

<pre><code>java.lang.arrayindexoutofboundsexception:2
       at prealert.listener.&lt;init&gt;.(Listener.Java:26)
       at prealert.listener.main(Listener.Java:40)
</code></pre>

<p>Thanks in advance for any help.</p>

<pre><code> package prealert;

    import org.apache.log4j.Logger;
    import org.apache.log4j.PropertyConfigurator;

    import jpcap.JpcapCaptor;
    import jpcap.NetworkInterface;

    public class Listener {

        private NetworkInterface[] devices;
        private NetworkInterface deviceName;
        private Reciever reciever;
        private JpcapCaptor jpcap;
        public static Logger log;


        public Listener() {
            PropertyConfigurator.configure("log4j.properties");
            log = Logger.getRootLogger();
            log.debug("Log4j has been initialized");
            devices = JpcapCaptor.getDeviceList();
            for (int i = 0; i &lt; devices.length; i++) {
                log.info(devices[i].description);
            }
            deviceName = devices[2];
            reciever = new Reciever();
            try {
                jpcap = JpcapCaptor.openDevice(deviceName, 2000, true, 100);
            } catch (Exception e) {
                log.error("Error with JPcapCreation", e);
            }
            reciever.jpcap = jpcap;
            reciever.start();
            new SetBoard(SetBoard.DEFAULT).start();
        }

        public static void main(String args[]) {
            try {
                new Listener();
            } catch (Exception e) {
                log.error("ERROR IN THE MAIN METHOD OF LISTENER!", e);
            }
        }
    }
</code></pre>
