###1. 三個主要的名詞:###java
###2. 它們的值範圍###code
0 <= mark <= position <= limit <= lengthip
###3. 三個主要方法###rem
(mark =-1; position =0;)get
(mark =-1; limit=position; position=0; )it
(mark =-1; limit=length; position =0;)io
###4. 樣例### 代碼:方法
<!-- lang: java --> ByteBuffer old = ByteBuffer.allocate(8); old.putInt(99); ByteBuffer newBuf = ByteBuffer.allocate(16); old.flip(); newBuf.put(old); newBuf.putInt(100); newBuf.flip(); System.out.println(newBuf.remaining()); System.out.println(newBuf.getInt()); System.out.println(newBuf.getInt());
控制檯輸出:im
8 99 100co