Java Hex Print printHexString(byte[] b)

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

Description

print Hex String

License

Open Source License

Declaration

public static String printHexString(byte[] b) 

Method Source Code

//package com.java2s;

public class Main {
    public static String printHexString(byte[] b) {
        String str = "";
        for (int i = 0; i < b.length; i++) {
            String hex = Integer.toHexString(b[i] & 0xFF);
            if (hex.length() == 1) {
                hex = '0' + hex;
            }//from   w ww  . ja  v  a  2s .c  o  m
            str += hex.toUpperCase();
        }
        return str;

    }
}

Related

  1. printHex(byte[] data)
  2. printHex(byte[] field, int start, int len)
  3. printHexa(final byte b)
  4. printHexBytes(byte[] _theBytes)
  5. printHexNumber(int n)
  6. printHexString(final StringBuilder sb, final String hexData)