public static byte[] Unicode2Byte(String s) {

来源:互联网 发布:炉石淘宝友谊赛封号 编辑:程序博客网 时间:2024/05/02 04:53
 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;
 }