Convert unicode To String - Android java.lang

Android examples for java.lang:String Unicode

Description

Convert unicode To String

Demo Code

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  ww  .  j a va2s.  c o m
    return str.toString();
  }

}

Related Tutorials