文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>大端 小端

大端 小端

时间:2007-05-28  来源:nongdi

小端 0000000 00c8 0000 6261 6463 0065 0064 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
*
大端
0000100 0000 c800 6261 6463 0065 0000 6400 0000
0000110 0000 0000 0000 0000 0000 0000 0000 0000
  import java.nio.*;
import java.io.*;
public class Byte
{
        public static void main(String[] args)
        {
                try
                {
                ByteBuffer bb = ByteBuffer.allocate(256);
                System.out.println("order=" + bb.order());
                //bb.order(ByteOrder.nativeOrder());
                System.out.println("order=" + bb.order());
                bb.putInt(200);
                byte[] bt = new byte[6];
                int i=0;
                bt[i++] = 'a';
                bt[i++] = 'b';
                bt[i++] = 'c';
                bt[i++] = 'd';
                bt[i++] = 'e';
                bt[i++] = 0;
                bb.put(bt);
                bb.putInt(100);
                File file = new File("a.bin");
                FileOutputStream fos = new FileOutputStream(file, true);
                fos.write(bb.array());
                System.out.println("bb=." + bb + ".");
                fos.close();

                }catch(Exception e) {   e.printStackTrace(); }
        }
}
相关阅读 更多 +
排行榜 更多 +
匿名爱人游戏

匿名爱人游戏

冒险解谜 下载
魔方仆从冲刺

魔方仆从冲刺

休闲益智 下载
跑山越野摩托

跑山越野摩托

体育竞技 下载