The title says it all, in my Slick2D state, I'm tracking the MouseX and MouseY coordinates and I want the X to be in between 8 < MouseX < 944 and the Y between 8 < MouseY < 573. Here is the concerned bit of code (if needed...):
int xpos = Mouse.getX();
int ypos = Mouse.getY();
Here's a solution:
int xpos = Math.max(Math.min(Mouse.getX(), 944), 8);
int ypos = Math.max(Math.min(Mouse.getY(), 573), 8);