Java Hex Calculate toHexString(byte b[])

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

Description

to Hex String

License

Open Source License

Declaration

public static String toHexString(byte b[]) 

Method Source Code

//package com.java2s;

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

    public static String toHexString(byte b[]) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < b.length; i++) {
            sb.append(HEX_CHARS.charAt(b[i] >>> 4 & 0xf));
            sb.append(HEX_CHARS.charAt(b[i] & 0xf));
        }/*from w w  w  .  ja v  a 2  s  . co  m*/

        return sb.toString();
    }
}

Related

  1. toHexString(byte b)
  2. toHexString(byte b)
  3. toHexString(byte b)
  4. toHexString(byte b[])
  5. toHexString(byte b[])
  6. toHexString(byte b[])
  7. toHexString(byte buffer[])
  8. toHexString(byte buffer[])
  9. toHexString(byte bytes[])