title: Java Error to do with array searching
body: <p>Hey guys i'm trying to use drawString() function to draw the result from a search in a array. I am using the code below</p>
  
  <pre><code>import java.awt.Graphics;
  
  public class canvas extends JPanel{
      int i, count;
      public String read_string = "";
      public String[] names = {"Duncan","Matthew","Kevin","Etc"};
      public String[] searchfor = {"Duncan","Kevin"};
      public canvas() {
  
      search();
  
  
      }
  
      public void search() {
  
          for(i=0; i&lt;names.length; i++) {
              read_string = names[i];
              if(read_string.contains("Duncan") || read_string.contains("Kevin")) {
  
                  count++;
  
                  System.out.println(read_string);
                  drawThatText(null, read_string, 500*i + 1, 500*i + 1);
              } else {
  
              }
  
  
          }
      }
  
  
      public void drawThatText(Graphics g, String s, int x, int y) {
  
  
          g.drawString(s, x, y);
  
      }
  }
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>Duncan
  java.lang.ExceptionInInitializerError
  Caused by: java.lang.ArithmeticException: / by zero
      at canvas.search(canvas.java:33)
      at canvas.&lt;init&gt;(canvas.java:19)
      at Client.&lt;clinit&gt;(Client.java:10)
  Exception in thread "main" 
  </code></pre>