现在的位置: 首页 > 综合 > 正文

public static byte[] Unicode2Byte(String s) {

2013年12月07日 ⁄ 综合 ⁄ 共 220字 ⁄ 字号 评论关闭

 public static byte[] Unicode2Byte(String s) {
  int len = s.length();
  byte abyte[] = new byte[len << 1];
  int j = 0;
  for (int i = 0; i < len; i++) {
   char c = s.charAt(i);
   abyte[j++] = (byte) (c >> 8);
   abyte[j++] = (byte) (c & 0xff);
  }
  return abyte;
 }

抱歉!评论已关闭.