Java examples for java.lang:Hex
byte to Hex String
public class Main { public static String byte2Hex(byte buf[]) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < buf.length; i++) { String hex = Integer.toHexString(buf[i] & 0xFF); if (hex.length() == 1) { hex = '0' + hex; }/* w ww . ja va 2 s . c om*/ sb.append(hex); } return sb.toString(); } }