Java Byte Array to Hex byteToHex(byte bytes[])

Here you can find the source of byteToHex(byte bytes[])

Description

byte To Hex

License

Apache License

Declaration

public static final String byteToHex(byte bytes[]) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static final String byteToHex(byte bytes[]) {
        char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
        StringBuffer buf = new StringBuffer(bytes.length * 2);
        for (int i = 0; i < bytes.length; ++i) {
            buf.append(hexDigits[(bytes[i] & 0xf0) >> 4]);
            buf.append(hexDigits[bytes[i] & 0x0f]);
        }/*from   w w  w . j  a  va2s .com*/
        return buf.toString();
    }
}

Related

  1. byteToBcd(byte src)
  2. byteToHex(byte b)
  3. byteToHex(byte b)
  4. byteToHex(byte b[])
  5. byteToHex(byte b[])
  6. byteToHex(byte data)
  7. byteToHex(byte[] array)
  8. byteToHex(byte[] array, String separator)
  9. byteToHex(byte[] b, int size)