Java Hex Calculate toHexString(byte[] array)

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

Description

to Hex String

License

Apache License

Declaration

public static String toHexString(byte[] array) 

Method Source Code

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

public class Main {
    public static String toHexString(byte[] array) {
        if (array == null) {
            return "";
        }//from  ww  w . j a  va 2s. c o  m
        StringBuilder sb = new StringBuilder(array.length * 2);
        for (byte byt : array) {
            int v = byt & 0xff;
            if (v < 16) {
                sb.append('0');
            }
            sb.append(Integer.toHexString(v));
        }
        return sb.toString().toUpperCase();
    }
}

Related

  1. toHexString(byte n)
  2. toHexString(byte value)
  3. toHexString(byte value)
  4. toHexString(byte[] arr)
  5. toHexString(byte[] array)
  6. toHexString(byte[] b)
  7. toHexString(byte[] b)
  8. toHexString(byte[] b)
  9. toHexString(byte[] b)