Here you can find the source of toHex(int val)
Parameter | Description |
---|---|
val | The integer |
public static String toHex(int val)
//package com.java2s; public class Main { final static char[] HEX_DIGIT = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; /**/*from www . j av a2 s.co m*/ * Converts one int to a hexadecimal ASCII string. * * @param val The integer * @return The hex string */ public static String toHex(int val) { int val1, val2; val1 = (val >> 4) & 0x0F; val2 = (val & 0x0F); return ("" + HEX_DIGIT[val1] + HEX_DIGIT[val2]); } }