asDoubleBuffer(): This method is available in java.nio.ByteBuffer class of Java.
Syntax:
DoubleBuffer java.nio.ByteBuffer.asDoubleBuffer()
This method creates a view of this byte buffer as a double buffer. The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.
Parameters: NA
Returns: A new double buffer
Approach
Java
import java.nio.ByteBuffer;public class ByteBufferasDoubleBuffer {public static void main(String[] args) {byte array[] = { 1, 2, 3, 4 };ByteBuffer bb = ByteBuffer.wrap(array);System.out.println(bb.asDoubleBuffer());}}
Output:
java.nio.ByteBufferAsDoubleBufferB[pos=0 lim=0 cap=0]
No comments:
Post a Comment