Java Hex Calculate toHexStr(byte[] b)

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

Description

to Hex Str

License

Apache License

Declaration

public static String toHexStr(byte[] b) 

Method Source Code

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

public class Main {

    public static String toHexStr(byte[] b) {
        StringBuffer buffer = new StringBuffer();
        for (int i = 0; i < b.length; ++i) {
            buffer.append(toHexStr(b[i]));
        }//from   w w  w  .  j av  a 2  s.co m
        return buffer.toString();
    }

    public static String toHexStr(byte b) {
        String s = Integer.toHexString(b & 0xFF);
        if (s.length() == 1) {
            return "0" + s;
        } else {
            return s;
        }
    }
}

Related

  1. ToHexNumber(int c)
  2. toHexOrNegative(int i)
  3. toHexPadZero(byte[] bytes)
  4. toHexShortString(byte[] bytes)
  5. toHexStr(byte b[])
  6. toHexStr(byte[] binary)
  7. toHexStream(byte[] bytes, String delimiter, boolean prefixEachValue, boolean upperCase)
  8. toHexString(byte a)
  9. toHexString(byte abyte0[], boolean spaceFlag)