char怎么可以转成数组?!
你是说String吗?

解决方案 »

  1.   

    value for a char[] object
    s for a String object
    b for a byte[] object
    so that:
    s=new String(value);//transfer a char[] to a String
    b=s.getBytes();
      

  2.   

    char=>s=>byte[]:
    s=String.valueOf(c);//transfer a char to a String
    b=s.getBytes();char[]=>s=>byte[]:
    s=new String(value);//transfer a char[] to a String
    b=s.getBytes();
      

  3.   

    /**
         * Converts a char to an array of shorts
         * containing the value of the each bit in
         * the binary value of that char, most
         * significant bit first.  This makes manipulating
         * values (eg with 7-bit encoding) easier than using
         * Integer.toBinaryString(). 
         * @param value the char to convert to a binary
         * @return an array of shorts representing the
         * binary value of value, with a length of six
         */
        public static short[] getBinary(char value)
        {
            int bitlen = 8;
            int val = value & ((1 << bitlen)-1); // keep only lowest bitlen bits
            short[] bin = new short[bitlen];
            // Set the appropriate digits in bin
            while (val > 0) {
                bin[--bitlen] = (short)(val & 1);
                val /= 2;
            }
            return bin;
        }
      

  4.   

    反正java已经够慢了,再慢点无所谓
    有现成的就用现成的,只要能满足要求就行了!^_^
      

  5.   

    Replace "val / = 2" by "var = var >> 1" maybe better.