atoi in java for negative values

I am writing an atoi function in java. It runs fine for +ve integers. But what i want is when I enter a negative integer it should give me an error. So i tried including continue statement in my class atoi. The class implemented is:

what if this is the input string: -1-2-3-4-5? The result will be interesting! EDIT: try this input also: 'répa'... Even more interesting result!

Don't forget to test with incorrect inputs too, and as @Klaus suggested, don't hesitate to throw an exception, (preferably IllegalArgumentException) with a correct error message, if an incorrect input is given to the function...