Here you can find the source of toHexString(byte[] bytes)
Parameter | Description |
---|---|
bytes | input value |
public static String toHexString(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { private static final char[] base32 = "0123456789abcdefghijklmnopqrstuv".toCharArray(); /**/*from w ww . jav a 2 s .c o m*/ * byte array to base16 * * @param bytes input value * @return hex representation of the byte array */ public static String toHexString(byte[] bytes) { final char[] res = new char[bytes.length * 2]; for (int i = 0; i < bytes.length; i++) { int t = ((int) bytes[i]) & 0xFF; res[i * 2] = base32[(t >> 4) & 15]; res[i * 2 + 1] = base32[t & 15]; } return String.valueOf(res); } }