Damn bugs, go away

I get an indexoutofboundsException if i do this, and if I put MAX_WIDTH
* MAX_HEIGHT, I get a NullPointerException.... HELP