Android Byte Array to Hex Convert bytesToHexString(byte[] values)

Here you can find the source of bytesToHexString(byte[] values)

Description

bytes To Hex String

Declaration

public static String bytesToHexString(byte[] values) 

Method Source Code

//package com.java2s;

public class Main {
    final protected static char[] hexArray = { '0', '1', '2', '3', '4',
            '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };

    public static String bytesToHexString(byte[] values) {
        String hex = "";
        for (int j = 0; j < values.length; j++) {
            hex += byteToHexString(values[j]);
            if (j < values.length - 1)
                hex += " ";
        }//  w  ww .  ja  v a  2 s.  c om
        return hex;
    }

    public static String byteToHexString(byte value) {
        int unsigned = value & 0xFF;
        return "" + hexArray[unsigned >>> 4] + hexArray[unsigned & 0x0F];
    }
}

Related

  1. bytesToHex(byte[] bytes)
  2. bytesToHex(byte[] bytes)
  3. bytesToHexString(byte[] b)
  4. bytesToHexString(byte[] src)
  5. bytesToHexString(byte[] src)
  6. bytesAsHexString(byte[] bytes, int maxShowBytes)
  7. toHexString(byte[] bytes)
  8. toHexString(byte[] bytes)
  9. toHexString(byte[] bytes, int numBytes)