fast implementation of ReverseInteger