Here you can find the source of byteToHex(char val)
Parameter | Description |
---|---|
val | a parameter |
private static String byteToHex(char val)
//package com.java2s; public class Main { private static final String HEX = "0123456789ABCDEF"; /**/*from w w w .jav a 2 s . c om*/ * Convert a byte to its hexadecimal value. * * @param val * @return */ private static String byteToHex(char val) { int hi = (val & 0xF0) >> 4; int lo = (val & 0x0F); return "" + HEX.charAt(hi) + HEX.charAt(lo); } }