Java Hex Calculate tohex(byte[] arg)

Here you can find the source of tohex(byte[] arg)

Description

tohex

License

Open Source License

Declaration

public static String tohex(byte[] arg) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String tohex(byte[] arg) {

        String res = "";
        String a;//from   w w  w.j  ava  2s .  c o m

        for (int i = 0; i < arg.length; i++) {
            a = Integer.toHexString(((int) arg[i]) & 0xFF);

            if (a.length() == 1)
                a = "0" + a;

            res += a;
        }

        return res;

    }
}

Related

  1. toHex(byte value)
  2. toHex(byte... bs)
  3. toHex(byte... bytes)
  4. toHex(byte[] a)
  5. toHex(byte[] address, StringBuilder builder)
  6. toHex(byte[] arr)
  7. toHex(byte[] array)
  8. toHex(byte[] array, int offset, int length)
  9. toHex(byte[] b)