Android examples for java.lang:Byte Array
Converts a byte array to its hexadecimal representation in String form
import android.util.Log; import java.io.UnsupportedEncodingException; import java.math.BigInteger; public class Main{ /**//ww w.ja v a 2s. c o m * Converts a byte array to its hexadecimal representation in String form. Useful for debugging * @param data byte[] of data to convert * @return hex of input */ public static String bin2hex(byte[] data) { return String.format("%0" + (data.length * 2) + "X", new BigInteger(1, data)); } }