Create a DoubleBuffer in Java
Description
The following code shows how to create a DoubleBuffer.
Example
//from w w w. j a v a2s . c o m
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
public class Main {
public static void main(String[] argv) throws Exception {
ByteBuffer buf = ByteBuffer.allocate(15);
buf.put("java2s.com".getBytes());
buf.rewind();
DoubleBuffer dbuf = buf.asDoubleBuffer();
System.out.println(dbuf.toString());
}
}
The code above generates the following result.