1、不需要补0: String hex= Integer.toHexString(numb); 2、需要补0: String hex= String.format("%02x",numb);//0代表补0,2代表2位,x代表16进制整型