sitelink1 | |
---|---|
sitelink2 | |
sitelink3 | |
sitelink4 | |
sitelink5 | |
sitelink6 |
·미리보기 | 소스복사·
- public class NumberUtils {
- /**
- * Hex -> 10진수 변환
- * @param hex
- * @return
- */
- public static String getHexToDec(String hex) {
- long v = Long.parseLong(hex, 16);
- return String.valueOf(v);
- }
- /**
- * 10진수 -> Hex 변환
- * @param dec
- * @return
- */
- public static String getDecToHex(String dec) {
- long intDec = Long.parseLong(dec);
- return Long.toHexString(intDec).toUpperCase();
- }
- /**
- * 10진수 -> Hex 변환
- * @param dec
- * @return
- */
- public static String getDecToHex(long dec) {
- return Long.toHexString(dec).toUpperCase();
- }
- }