Android Byte Array to Hex Convert byteArrayToHexString(byte[] byteArray)

Here you can find the source of byteArrayToHexString(byte[] byteArray)

Description

Converts a byte[] to a hex string

Parameter

Parameter Description
byteArray Array to be converted

Return

Array as a hex string

Declaration

public static String byteArrayToHexString(byte[] byteArray) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from w  ww  .  ja va 2  s. c o  m*/
     * Converts a byte[] to a hex string
     *
     * @param byteArray Array to be converted
     * @return Array as a hex string
     */
    public static String byteArrayToHexString(byte[] byteArray) {
        final StringBuilder builder = new StringBuilder();
        for (byte b : byteArray) {
            builder.append(String.format("%02x", b));
        }
        return builder.toString();
    }
}

Related

  1. encodeHex(byte[] data)
  2. encodeHex(byte[] data)
  3. convertToHex(byte[] data)
  4. byteArrayToHexString(byte[] array)
  5. byteArrayToHexString(byte[] b)