String mypwd="zjq3333";
要将这个mypwd转为ASICC码.怎么做?

解决方案 »

  1.   

    public static void other2Ascci() {
            String strSourc = "中文字符信息";
            int len = strSourc.length();
            byte[] data = new byte[len];
            data = strSourc.toString().getBytes();
            byte[] tempByte = new byte[3];
            try {
                for (int i = 0; i < len; i++) {
                    tempByte[0] = data[i];
                    i++;
                    if (i >= len)
                        break;
                    tempByte[1] = data[i];
                    i++;
                    if (i >= len)
                        break;
                    tempByte[2] = data[i];                String strResult = new String(tempByte);                int itemp = Integer.parseInt(strResult);
                    if (itemp > 127 || itemp < -128) {
                        ; //fos.write( (byte) (itemp - 256));
                    }
                    else
                        ; //fos.write( (byte) itemp);
                }
            }
            catch (Exception e) {
                e.printStackTrace();
            }
        }
      

  2.   

    public static void main(String[] args) {
         byte[] cc = "zjq3333".getBytes();
         for (int i = 0; i < cc.length; i++){
         System.out.println(cc[i]);
         }
        }
      

  3.   

    public static void main(String[] args) {
         byte[] cc = "zjq3333".getBytes();
         for (int i = 0; i < cc.length; i++){
         System.out.println(cc[i]);
         }
        }