package com.daocaor.top.chapter1;
import java.nio.IntBuffer;
public class BufferDemo {
public static void main(String[] args) {
IntBuffer intBuffer = IntBuffer.allocate(10);
printBuffer(intBuffer);
System.out.println("=====写入12345======");
for(int i= 1 ; i <= 5; ++i){
intBuffer.put(i);
}
printBuffer(intBuffer);
}
public static void printBuffer(IntBuffer intBuffer){
System.out.println("position:"+intBuffer.position());
System.out.println("limit:"+intBuffer.limit());
System.out.println("capacity:"+intBuffer.capacity());
}
}