int num=65538;
    byte[] bs = new byte[4];
    for(int i=3;i>=0;i--) {
      bs[i] = (byte)(num%256);
      num >>=8;
    }
    for(byte b : bs) {
      System.out.println(b);
    }

解决方案 »

  1.   

     public void test() {
            int i = 1;
            short s = 85;
            byte b=(byte)i;
            byte b1=(byte)s;
            byte[] bb={b,b1};
            System.out.println("bb==="+bb.length);
        }
      

  2.   


    public void test() {
            int i = 1;
            short s = 85;
            byte b=(byte)i;
            byte b1=(byte)s;
            byte[] bb={b,b1};
            System.out.println("bb==="+bb.length);
        }