```
import numpy as np
class Solution(object):
def toHex(self, num):
"""
:type num: int
:rtype: str
"""
if num==0 :
return '0'
n=np.uint32(num)
tmp=''
while n:
mod=n%16
tmp+=chr(mod+ord('0')) if mod<10 else chr(mod-10+ord('a'))
n/=16
return tmp[::-1]
```