Here you can find the source of bytes2HexString(byte[] bytes)
Parameter | Description |
---|---|
bytes | a parameter |
public static String bytes2HexString(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { public static String bytes2HexString(byte[] bytes) { StringBuffer sb = new StringBuffer(bytes.length); String sTemp;//w ww . ja v a 2s . c o m for (int i = 0; i < bytes.length; i++) { sTemp = Integer.toHexString(0xFF & bytes[i]); if (sTemp.length() < 2) { sb.append(0); } sb.append(sTemp.toUpperCase()); } return sb.toString(); } }