Here you can find the source of toHexFromByte(byte b)
Parameter | Description |
---|---|
b | byte to be converted to hex string |
public static final StringBuilder toHexFromByte(byte b)
//package com.java2s; //License from project: Apache License public class Main { private static final String[] hexSymbols = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" }; /***//from w ww. j a va2s.c o m * Converts byte to hex string. * * @param b * byte to be converted to hex string * @return hex string */ public static final StringBuilder toHexFromByte(byte b) { byte leftSymbol = (byte) (b >>> 4 & 0xF); byte rightSymbol = (byte) (b & 0xF); return new StringBuilder(hexSymbols[leftSymbol] + hexSymbols[rightSymbol]); } }