Java Hex Calculate toHex(byte input[])

Here you can find the source of toHex(byte input[])

Description

to Hex

License

Apache License

Declaration

public static String toHex(byte input[]) 

Method Source Code

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

public class Main {
    public static String toHex(byte input[]) {
        if (input == null)
            return null;
        StringBuffer output = new StringBuffer(input.length * 2);
        for (int i = 0; i < input.length; i++) {
            int current = input[i] & 0xff;
            if (current < 16)
                output.append("0");
            output.append(Integer.toString(current, 16));
        }//  w  ww.j ava2  s  . co m

        return output.toString();
    }
}

Related

  1. toHex(byte data[])
  2. toHex(byte hash[])
  3. toHex(byte in)
  4. toHex(byte in[])
  5. toHex(byte in[])
  6. toHex(byte lowByte)
  7. toHex(byte n)
  8. toHex(byte one)
  9. toHex(byte value)