Android Hex String Create bt64ToHex(int[] byteData)

Here you can find the source of bt64ToHex(int[] byteData)

Description

bt To Hex

Declaration

private static String bt64ToHex(int[] byteData) 

Method Source Code

//package com.java2s;

public class Main {
    private static String bt64ToHex(int[] byteData) {
        String hex = "";
        for (int i = 0; i < 16; i++) {
            String bt = "";
            for (int j = 0; j < 4; j++) {
                bt += byteData[i * 4 + j];
            }/*w w w  .j av a2s . c o  m*/
            hex += bt4ToHex(bt);
        }
        return hex;
    }

    private static String bt4ToHex(String binary) {
        String hex = "";
        if (binary.equalsIgnoreCase("0000")) {
            hex = "0";
        } else if (binary.equalsIgnoreCase("0001")) {
            hex = "1";
        } else if (binary.equalsIgnoreCase("0010")) {
            hex = "2";
        } else if (binary.equalsIgnoreCase("0011")) {
            hex = "3";
        } else if (binary.equalsIgnoreCase("0100")) {
            hex = "4";
        } else if (binary.equalsIgnoreCase("0101")) {
            hex = "5";
        } else if (binary.equalsIgnoreCase("0110")) {
            hex = "6";
        } else if (binary.equalsIgnoreCase("0111")) {
            hex = "7";
        } else if (binary.equalsIgnoreCase("1000")) {
            hex = "8";
        } else if (binary.equalsIgnoreCase("1001")) {
            hex = "9";
        } else if (binary.equalsIgnoreCase("1010")) {
            hex = "A";
        } else if (binary.equalsIgnoreCase("1011")) {
            hex = "B";
        } else if (binary.equalsIgnoreCase("1100")) {
            hex = "C";
        } else if (binary.equalsIgnoreCase("1101")) {
            hex = "D";
        } else if (binary.equalsIgnoreCase("1110")) {
            hex = "E";
        } else if (binary.equalsIgnoreCase("1111")) {
            hex = "F";
        }

        return hex;
    }
}

Related

  1. toHexByte(String str, int offset, int length)
  2. toHexChar(int i)
  3. toHexDigits(byte theByte)
  4. toHexDigits(byte[] bytes)
  5. toHexString(byte oneByte)