Java Byte to Hex String byteToHexString(byte[] b)

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

Description

byte To Hex String

License

LGPL

Declaration

public static String byteToHexString(byte[] b) 

Method Source Code

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

public class Main {

    public static String byteToHexString(byte[] b) {
        StringBuffer hexString = new StringBuffer();
        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 ava2 s  .c o  m
            hexString.append(hex.toUpperCase());
        }
        return hexString.toString();
    }
}

Related

  1. byteToHexString(byte in)
  2. byteToHexString(byte num)
  3. byteToHexString(byte src)
  4. byteToHexString(byte value)
  5. byteToHexString(byte value)
  6. byteToHexString(byte[] b)
  7. byteToHexString(byte[] bytes)
  8. byteToHexString(byte[] bytes, int start, int end)
  9. byteToHexString(byte[] bytes, int start, int end)