Android Byte Array to Hex Convert convertToHex(byte[] raw)

Here you can find the source of convertToHex(byte[] raw)

Description

convert To Hex

License

Open Source License

Declaration

private static String convertToHex(byte[] raw) 

Method Source Code

//package com.java2s;

public class Main {
    private static final String HEX_DIGITS = "0123456789abcdef";

    private static String convertToHex(byte[] raw) {
        final StringBuilder hex = new StringBuilder(raw.length * 2);

        for (final byte b : raw) {
            hex.append(HEX_DIGITS.charAt((b & 0xF0) >> 4)).append(
                    HEX_DIGITS.charAt((b & 0x0F)));
        }//  w  ww .j a  va  2  s .c om

        return hex.toString();
    }
}

Related

  1. bytesToHex(byte[] bytes, boolean withSpaces)
  2. byteArrayToHexString(byte[] bytes)
  3. byteArrayToHexString(byte[] bytes)
  4. bytesToHex(byte[] data)
  5. convertToHex(byte[] in)
  6. bytes2Hex(byte[] bts)
  7. bytes2HexString(byte[] bytes)
  8. bytes2hex(byte[] bytes)
  9. bytesToHex(byte[] bytes)