Java : Error handling: exception when argument of type int takes some specific values