Here you can find the source of toHexString(byte[] bytes)
Parameter | Description |
---|---|
bytes | byte array to convert |
public static String toHexString(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w . ja va2 s . c o m*/ * Convert a set of bytes into a hexadecimal string. Useful for storing MD5's as strings. * @param bytes byte array to convert * @return a Hexadecimal string representation of the bytes passed in. */ public static String toHexString(byte[] bytes) { StringBuilder sb = new StringBuilder(); for (byte aByte : bytes) { sb.append(Integer.toHexString(0xff & aByte)); } return sb.toString(); } }