First, note that this problem said treat n as a 'unsigned value', so we should use >>> rather than >>. >> ignore the sign digit which will cause a infinite loop.
Second, you should change while(n!=0) to while(i<32), this ensure every digit will mirror.
midmid can be overflow. For your further concern, we should use 'sub/divide' to check this kind of condition, such as if we are checking whether a10 will overflow, we can't use a*10>Integer.MAX_VALUE(which will be always false) instead of a>Integer.MAX_VALUE/10.
The values of index1 and curr are passed by value the changes made to them inside the function addNode are temporary because when the function addNode returns the changes are not reflected in the calling function.