Java Unicode Create toUnicodeString(char[] chars)

Here you can find the source of toUnicodeString(char[] chars)

Description

to Unicode String

License

Open Source License

Declaration

public static String toUnicodeString(char[] chars) 

Method Source Code

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

public class Main {
    public static String toUnicodeString(char[] chars) {
        StringBuffer strBuf = new StringBuffer();
        for (int i = 0; i < chars.length; i++) {
            strBuf.append("\\u").append(Integer.toHexString(chars[i]));
        }/*  w ww  .  j  a  v  a  2 s  . com*/
        return strBuf.toString();
    }

    public static String toString(Object object) {
        return toString(object, null);
    }

    public static String toString(Object object, String defaultValue) {
        if (object == null)
            return defaultValue;
        return String.valueOf(object);
    }
}

Related

  1. toUnicodeRepresentation(String str)
  2. toUnicodeStr(int i)
  3. toUnicodeString(byte[] ba)
  4. toUnicodeString(byte[] data)
  5. toUnicodeString(char c)
  6. toUnicodeString(String baseString)
  7. toUnicodeString(String s)
  8. toUnicodeString(String str)
  9. toUnicodeSymbols(String s)