Share on Google+Share on Google+

Get the capacity of a double type buffer

Advertisement
In this tutorial we will see how to get the capacity of a double type buffer

Get the capacity of a double buffer

In this tutorial we will see how to get size of a double buffer using capacity() method.

Code:

import java.nio.DoubleBuffer;

public class DoubleBufferDemo {
  public static void main(String[] args) {
    DoubleBuffer doublebuffer = DoubleBuffer.allocate(6);
    doublebuffer.put(324.242).put(3534.3432).put(85.342).put(454.453).put(
        354.3424).put(4334.343);
    System.out.println(doublebuffer.capacity());
  }
}

Output:

  6

Download this code

Advertisements

Posted on: July 28, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.