Here you can find the source of Unicode2GBK(String dataStr)
public static String Unicode2GBK(String dataStr)
//package com.java2s; //License from project: Apache License public class Main { public static String Unicode2GBK(String dataStr) { int index = 0; StringBuffer buffer = new StringBuffer(); int li_len = dataStr.length(); while (index < li_len) { if (index >= li_len - 1 || !"\\u".equals(dataStr.substring(index, index + 2))) { buffer.append(dataStr.charAt(index)); index++;//from www. j a v a 2s.c o m continue; } String charStr = ""; charStr = dataStr.substring(index + 2, index + 6); char letter = (char) Integer.parseInt(charStr, 16); buffer.append(letter); index += 6; } return buffer.toString(); } }