title: How do I fix the "Coordinates out of bounds" error in my code in Java?
body: <p>Here is what my code looks like. I am getting an error that says "Exception in thread "main" java.lang.arrayIndexOutofBoundsException: Coordinate out of bounds!"
  I do not know what this means or how to fix it, so any help is greatly appreciated.</p>
  
  <pre><code>import java.awt.Color;
  
  public class Assignment9 {
  
      /**
       * @param args
       * @return
       */
  
      public static void removeBlue(Picture pic){
          Color cPic = pic.get(100,100);
          //remove blue color pane from image, set blue weight to 0
          int h = pic.height();
          int w = pic.width();
          System.out.println(cPic);
          //^this shows the red, green, and blue weights
          int b = cPic.getBlue();
          int r = cPic.getRed();
          int g = cPic.getGreen();
          System.out.println("r=" +r +"g="+g+"b="+b);
          pic.setColor(w, h, r, g, 0);   
          for(int x=0; x&lt;w ; x++){
                  //need to set color
                  pic.setColor(w, h, r, g, 0);}
  
      }
      public static void drawredStripe(Picture pic){
      //draw a red vertical stripe that is 200 pixels wide through the middle of the image
          Color cPic = pic.get(100,100);
          int h = pic.height();
          int w = pic.width();
          int b = cPic.getBlue();
          int r = cPic.getRed();
          int g = cPic.getGreen();
          for(int x=0; x&lt;h ; x++){
              for (int y = (w/2)-100; y &lt;(w/2)+100; y++){
                  //need to set color
                  pic.setColor(x, y, r, 0, 0);
              }
          }
  
      }
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          Picture dolphin= new Picture("dolphin_swimming.jpg");
          removeBlue(dolphin);   
          dolphin.show();
          drawredStripe(dolphin);
          dolphin.show(); 
  }
  }
  </code></pre>