Android Hex String Create toHex(byte input[])

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

Description

to Hex

Declaration

public static String toHex(byte input[]) 

Method Source Code

//package com.java2s;

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  w  w.  j  ava2s  .c  o m*/

        return output.toString();
    }
}

Related

  1. hexEncode(byte[] aInput)
  2. hexify(byte bytes[])
  3. toHex(String str)
  4. toHex(String txt)
  5. toHex(byte b)
  6. toHex(byte[] bytes)
  7. toHex(byte[] data)
  8. toHex(int address)
  9. toHexByte(String str, int offset, int length)