I added a check for MIN_VALUE, because I could provide a correct implementation for it.
It is easy to detect inputs that would result in overflow as well:
  (val > Integer.MIN_VALUE >> 1)

The problem with the last check is that I don't know what the correct behavior should be in that case. Throw an exception? Return 0? Return -1?

All other inputs return the correct result.