byte b[] = {1,2,3};用这里的1,2,3去构造一个String代表的是Ascii啊,不是乱码65===>>'A'

解决方案 »

  1.   

    char b[] = {'1','2','3'};

    System.out.println(new String(b));
      

  2.   

    class TestArray
    {
    public static void main(String[] args) 
    {
    byte b[] = {49,50,51}; try {
    System.out.println(new String(b,"gb2312"));
    }
    catch (Exception e) {

    }
    }
    }
      

  3.   

    byte b[] = {1,2,3};
    StringBuffer sb=new StringBuffer();
    for(int i=0;i<b.length;i++)
      sb.append(b[i]);System.out.println(sb.toString());这回满意了吧
      

  4.   

    byte b[] = "123".getBytes();
    和byte b[]={1,2,3}不一样吗?还是byte b[] = {'1','2'.'3'}
      

  5.   

    byte b[] = new byte[8];
    Util.bytesMemcpy(b, header, 0, 48, b.length);//把header数组的从48拷到b中0开始处
    int len = Integer.parseInt((new String(b)).trim());
    在第三行抛出:java.lang.NumberFormatException: For input string: ""异常
      

  6.   

    问题用treeroot的方法解决了,谢谢大家!