Exception handling

class IsNullException extends RuntimeException { }
class IsEmptyException extends RuntimeException { }

void throwWhenNullOrEmpty(int[] array)
{
    if (array == null) {
        throw new IsNullException();
    }
    if (array.length == 0) {
        throw new IsEmptyException();
    }
}

try {
    throwWhenNullOrEmpty(null);
}
catch (Exception e) {
    System.out.println("Error happened");
}