Android examples for java.lang:Byte Array
Convert byte to hex
//package com.java2s; public class Main { public static String byte2hex(byte[] b) { StringBuffer sb = new StringBuffer(b.length * 2); String tmp = ""; for (int n = 0; n < b.length; n++) { tmp = (java.lang.Integer.toHexString(b[n] & 0XFF)); if (tmp.length() == 1) { sb.append("0"); }/*ww w . jav a2 s .c o m*/ sb.append(tmp); } return sb.toString().toUpperCase(); } }