Java Byte Array to Hex bytes2HexString(byte[] b)

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

Description

bytes Hex String

License

Apache License

Declaration

public static String bytes2HexString(byte[] b) 

Method Source Code

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

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

Related

  1. bytes2HexSplit(byte[] in, int wordlength)
  2. bytes2HexStr(byte[] bytes)
  3. bytes2HexStr(byte[] bytes)
  4. bytes2HexString(byte... bytes)
  5. bytes2HexString(byte[] array)
  6. bytes2HexString(byte[] b)
  7. bytes2HexString(byte[] b)
  8. bytes2HexString(byte[] bytes)
  9. bytes2HexString(byte[] bytes)