Presented below is a way to declare global constants. Using them is pretty easy since they are public and static.

Java Code:
public class CONSTANT {
  public static final integer SUCCESS = 1;
  public static final integer FAILURE = -1;
  public static final integer NOTFOUND = 0;
}
...
if (myMethod()==CONSTANT.SUCCESS) {
   ...;
   }
else {
   ...;
}