The Integer class has methods to do that.