String s="hello";
byte[] data1=s.getBytes();
byte[] data2=s.getBytes("GBK");

解决方案 »

  1.   

    getBytes() 
              Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array.getBytes(String charsetName) 
              Encodes this String into a sequence of bytes using the named charset, storing the result into a new byte array.楼主这种问题最好去查一下jdk的帮助
    看一下相关类的方法就是了
      

  2.   

    艾,我们项目组用的是JDK1.3,换成JDK1。4getBytes()方法就出来了,;(