I have always been fascinated by the Design by Contract approach:
Software always had bugs and always will”. Tired of this defeatist attitude? With Design by Contract, invented by Eiffel Software and one of the most widely recognized breakthroughs in the history of software engineering, you can write complex software and not wake up at night fearing that something, somewhere will go wrong. Design by Contract brings science to the construction of correct and robust software.
From this point of view, unfortunately, Java is not Eiffel. Therefore, even if I would have follow this Bertrand Meyer valuable concept, I had to cope with the language itself. I know in the past years some Java frameworks which implement Design by Contract have been proposed, but I have never had the chance to try them seriously. So what I do is simply checking input method parameters.