Here you can find the source of byteToHex(byte b)
Parameter | Description |
---|---|
b | The byte value. |
public static String byteToHex(byte b)
//package com.java2s; //License from project: Apache License public class Main { /**/* ww w . ja va 2 s . c om*/ * Converts a byte to a hexadecimal string. * * @param b The byte value. * @return The hexadecimal string. */ public static String byteToHex(byte b) { String str = ""; if (((int) b & 0xff) < 0x10) { str += "0"; } str += Long.toString((int) b & 0xff, 16); return str.toUpperCase(); } }