Android Unicode to String Convert unicodeToString(String hex)

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

Description

unicode To String

Declaration

public static String unicodeToString(String hex) 

Method Source Code

//package com.java2s;

public class Main {

    public static String unicodeToString(String hex) {
        int t = hex.length() / 6;
        StringBuilder str = new StringBuilder();
        for (int i = 0; i < t; i++) {
            String s = hex.substring(i * 6, (i + 1) * 6);
            String s1 = s.substring(2, 4) + "00";
            String s2 = s.substring(4);
            int n = Integer.valueOf(s1, 16) + Integer.valueOf(s2, 16);
            char[] chars = Character.toChars(n);
            str.append(new String(chars));
        }/*  w  w w . j  ava 2  s .com*/
        return str.toString();
    }
}

Related

  1. unUnicode(String s)
  2. getFromCompressedUnicode(final byte[] string, final int offset, final int len)