Here you can find the source of bytesToHex(byte[] bytes)
Parameter | Description |
---|---|
bytes | a parameter |
public static String bytesToHex(byte[] bytes)
//package com.java2s; //License from project: Apache License public class Main { /**//from w w w . j a v a2 s.c om * * @param bytes * @return */ public static String bytesToHex(byte[] bytes) { StringBuffer hexString = new StringBuffer(); for (int i = 0; i < bytes.length; i++) { String hex = Integer.toHexString(bytes[i] & 0xFF); if (hex.length() < 2) { hexString.append(0); } hexString.append(hex); } return hexString.toString(); } }