Home Tutorial Java Corejava Nio Writes the given double value into a buffer at the given index.

 
 

Writes the given double value into a buffer at the given index.
Posted on: July 28, 2010 at 12:00 AM
Advertisement
In this tutorial you will see how to write the given double into buffer at the given index.

Writes the given double value into a buffer at the given index.

In this tutorial you will see how to write the given double into buffer at the given index. The put (int index, double d) allow to write a character at particular index. It also allow to overwrite the content of the buffer which can be seen in this example.

Code:

import java.nio.DoubleBuffer;

public class DoubleBufferDemo {
  public static void main(String[] argvthrows Exception {
    DoubleBuffer buffer = DoubleBuffer.allocate(8);
    buffer.put(44.23).put(43.53).put(65.343);
    buffer.put(111.111);
    buffer.put(3675.434).put(4243.533);
    System.out.println(buffer.get(1));
  }
}

Output:

  11.111

Download this code

Advertisement

Related Tags for Writes the given double value into a buffer at the given index.:


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.

Posted on: July 28, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com