Here you can find the source of byteToHexString(byte[] bytes)
Parameter | Description |
---|---|
bytes | a parameter |
private static String byteToHexString(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { /**/*ww w . j ava 2s . c om*/ * This methos used to convert byte array to hex string * @param bytes * @return */ private static String byteToHexString(byte[] bytes) { StringBuffer sb = new StringBuffer(bytes.length * 2); for (int i = 0; i < bytes.length; i++) { int v = bytes[i] & 0xff; if (v < 16) { sb.append('0'); } sb.append(Integer.toHexString(v)); } return sb.toString().toUpperCase(); } }