Java Hex Calculate toHex(byte... bs)

Here you can find the source of toHex(byte... bs)

Description

Return hex encoded string from bytes

License

Apache License

Declaration

public static String toHex(byte... bs) 

Method Source Code

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

public class Main {
    private static final char[] HEXDIGITS = "0123456789abcdef".toCharArray();

    /** Return hex encoded string from bytes */
    public static String toHex(byte... bs) {
        StringBuilder result = new StringBuilder(bs.length * 2);
        for (byte b : bs) {
            result.append(HEXDIGITS[(b >> 4) & 0xF]);
            result.append(HEXDIGITS[(b & 0xF)]);
        }//from w w w . j ava 2s  . c o m
        return result.toString();
    }
}

Related

  1. toHex(byte lowByte)
  2. toHex(byte n)
  3. toHex(byte one)
  4. toHex(byte value)
  5. toHex(byte value)
  6. toHex(byte... bytes)
  7. toHex(byte[] a)
  8. toHex(byte[] address, StringBuilder builder)
  9. tohex(byte[] arg)