Android Byte Array to Hex Convert byteArray2HexString(byte[] data)

Here you can find the source of byteArray2HexString(byte[] data)

Description

byte Array Hex String

License

Open Source License

Declaration

public static String byteArray2HexString(byte[] data) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static final int BYTE_MASK = 0xff;

    public static String byteArray2HexString(byte[] data) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            String temp = Integer.toHexString(data[i] & BYTE_MASK);
            if (temp.length() == 1)
                temp = "0" + temp;
            sb.append(temp);/*from  w w w  .  ja va2 s.c  o  m*/
        }
        return sb.toString().toUpperCase();
    }
}

Related

  1. byte2HexString(byte[] b)
  2. byte2Hext(byte bin)
  3. byteArr2HexStr(byte[] arr)
  4. byteArr2HexStr(byte[] arrB)
  5. byteArr2HexStr(byte[] paramArrayOfByte)
  6. Convert2bytesHexaFormatToInt(byte[] ArrayToConvert)
  7. ConvertHexByteArrayToString( byte[] byteArrayToConvert)
  8. toHex(byte[] array)
  9. toHex(byte[] array, int offset, int len)