leetcode405专题

LeetCode405. Convert a Number to Hexadecimal

文章目录 一、题目二、题解 一、题目 Given an integer num, return a string representing its hexadecimal representation. For negative integers, two’s complement method is used. All the letters in the answer s

LeetCode405 Convert a Number to Hexadecimal

LeetCode405 Convert a Number to Hexadecimal 想到了一种新的方法,比以前的方法的效率要稍微好一些 public class solution {public String toHex(int num) {StringBuffer sb = new StringBuffer();//使用逻辑右移的方式进行处理char[] arr = {'0','1'