Android examples for java.lang:Byte Array
Convert bytes To Hex String
public class Main { public static String bytesToHexString(byte[] bytes) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { String hex = Integer.toHexString(0xFF & bytes[i]); if (hex.length() == 1) { sb.append('0'); }//from w w w. jav a 2 s . c o m sb.append(hex); } return sb.toString(); } }