Java ByteBuffer create byte buffer of capacity 8
import java.nio.ByteBuffer; public class Main { public static void main(String[] args) { // Create a byte buffer of capacity 8 ByteBuffer bb = ByteBuffer.allocate(8); System.out.println("Capacity: " + bb.capacity()); System.out.println("Limit: " + bb.limit()); System.out.println("Position: " + bb.position()); }/* w ww . jav a 2s . co m*/ }