import java.nio.*; import java.io.FileInputStream; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; public class ByteArrayBuffer{ public static void main(String[] args) throws Exception { byte[] size=new byte[255]; FileInputStream finStream = new FileInputStream(args[0]); System.out.println("Name of file :" + args[0]); FileChannel fchannel = finStream.getChannel(); ByteBuffer bytebuf = ByteBuffer.wrap(size); fchannel.read(bytebuf); System.out.println("Capacity of ByteArraytBuffer : " + bytebuf.capacity()); } }