Here you can find the source of getGBKByteLength(String data)
public static int getGBKByteLength(String data)
//package com.java2s; import java.io.UnsupportedEncodingException; public class Main { public static int getGBKByteLength(String data) { if (data == null) { return 0; }/*from w ww.j a v a 2 s.c o m*/ try { return data.getBytes("GBK").length; } catch (UnsupportedEncodingException e) { return data.getBytes().length; } } }