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
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

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


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.