日期:2014-05-20 浏览次数:20891 次
import java.io.*;
public class Test2
{
    public static void main(String[] args) throws IOException
    {
        int a = 0x12345678;
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(baos);
        dos.writeInt(a);
        byte[] b = baos.toByteArray();
        for(int i = 3; i >= 0; i--)
        {
            System.out.print(Integer.toHexString(b[i]));
        }
        System.out.println();
    }
}
// Output: 78563412
0x12在int中应该是高地址,转为字节数组后为什么是低地址了?