62,623
社区成员
发帖
与我相关
我的任务
分享 byte[] bs = str.getBytes("GBK");
for(int i=0;i<bs.length;i++) {
if(bs[i]<0) {
System.out.println(2);
i++;
}else {
System.out.println(1);
} public static void main(String[] args) throws UnsupportedEncodingException {
double[] space = { 51.0, 0.0, 52.0, 0.0, 53.0, 54.0, 55.0, 0.0, 56.0, 56.0 };
String str = "零一23四56";
char[] chs = str.toCharArray();
for (char c : chs) {
System.out.println(Character.toString(c).getBytes("GBK").length);
}
}String s = new String(space,"GBK"); //