Java Hex Calculate toHexString(byte[] paramArrayOfByte)

Here you can find the source of toHexString(byte[] paramArrayOfByte)

Description

to Hex String

License

Open Source License

Declaration

public static String toHexString(byte[] paramArrayOfByte) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static final char[] HEX_DIGITS = { 48, 49, 50, 51, 52, 53, 54,
            55, 56, 57, 97, 98, 99, 100, 101, 102 };

    public static String toHexString(byte[] paramArrayOfByte) {
        if (paramArrayOfByte == null)
            return "";
        StringBuilder localStringBuilder = new StringBuilder(
                paramArrayOfByte.length << 1);
        for (int i = 0;; i++) {
            if (i >= paramArrayOfByte.length)
                return localStringBuilder.toString();
            localStringBuilder/*from   w ww .  j a va  2 s. c  om*/
                    .append(HEX_DIGITS[((0xF0 & paramArrayOfByte[i]) >>> 4)]);
            localStringBuilder
                    .append(HEX_DIGITS[(0xF & paramArrayOfByte[i])]);
        }
    }
}

Related

  1. toHexString(byte[] digestByte)
  2. toHexString(byte[] in)
  3. toHexString(byte[] input)
  4. toHexString(byte[] md)
  5. toHexString(byte[] messagePayload)
  6. toHexString(byte[] paramArrayOfByte, String paramString, boolean paramBoolean)
  7. toHexString(byte[] raw)
  8. toHexString(byte[] raw)
  9. toHexString(byte[] src)