Java Hex to String convertHexToString(String hex)

Here you can find the source of convertHexToString(String hex)

Description

convert Hex To String

License

Open Source License

Declaration

public static String convertHexToString(String hex) 

Method Source Code

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

public class Main {
    public static String convertHexToString(String hex) {

        StringBuilder sb = new StringBuilder();
        StringBuilder temp = new StringBuilder();

        for (int i = 0; i < hex.length() - 1; i += 2) {

            // grab the hex in pairs
            String output = hex.substring(i, (i + 2));
            // convert hex to decimal
            int decimal = Integer.parseInt(output, 16);
            // convert the decimal to character
            sb.append((char) decimal);

            temp.append(decimal);/*from   w w  w  . j a  v a 2s.  co  m*/
        }

        return sb.toString();
    }
}

Related

  1. convertHexStr(String inStr)
  2. convertHexString(String ss)
  3. convertHexStringToString(String hexString)
  4. formatHex(byte[] buf)
  5. formatHex(byte[] data)
  6. formatHexToWriter(byte[] buf, Writer writer, int actualLength)