Android Hex String Create hexEncode(byte[] aInput)

Here you can find the source of hexEncode(byte[] aInput)

Description

hex Encode

Declaration

public static String hexEncode(byte[] aInput) 

Method Source Code

//package com.java2s;

public class Main {
    public static String hexEncode(byte[] aInput) {
        StringBuilder result = new StringBuilder();

        char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                'a', 'b', 'c', 'd', 'e', 'f' };

        for (int idx = 0; idx < aInput.length; ++idx) {
            byte b = aInput[idx];

            result.append(digits[(b & 0xf0) >> 4]);
            result.append(digits[b & 0x0f]);
        }/*w ww .  jav  a  2  s . com*/

        return result.toString();
    }
}

Related

  1. encodeHex(byte[] bytes)
  2. encodeHex(byte[] pData)
  3. hex(int value, int digits)
  4. hexCharToInt(char c)
  5. hexDecode(String str, byte[] ba, int len)
  6. hexify(byte bytes[])
  7. toHex(String str)
  8. toHex(String txt)
  9. toHex(byte b)