一个字符串  如:     "我ABC"   又如“我 ABC”怎么转换成为字节数组

解决方案 »

  1.   

     byte[] getBytes(String charsetName) 
              使用指定的字符集将此 String 编码为 byte 序列,并将结果存储到一个新的 byte 数组中 
      

  2.   

     byte[] getBytes() Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array. 
     byte[] getBytes(Charset charset) Encodes this String into a sequence of bytes using the given charset, storing the result into a new byte array. 
     byte[] getBytes(String charsetName)Encodes this String into a sequence of bytes using the named charset, storing the result into a new byte array. 
      

  3.   

    byte[] getBytes(String charsetName) 
      

  4.   

    char[] toCharArray()
    转换到字符数组
    byte[] getBytes()
    转换到字节数组