LongBuffer.wrap(long[]): This method is available in java.nio.LongBuffer class of Java.
Syntax:
LongBuffer java.nio.LongBuffer.wrap(long[] array)
This method takes one argument of type long array as its parameter. This method wraps a long array into a buffer.
Note: The new buffer will be backed by the given long array; that is, modifications to the buffer will cause the array to be modified and vice versa.
Parameters: One parameter is required for this method.
array: The array that will back this buffer.
Returns: The new long buffer.
Exceptions: NA
Approach
Java
import java.nio.LongBuffer;public class LongBufferwrap {public static void main(String[] args) {long array[] = { 1, 2, 3, 4 };System.out.println(LongBuffer.wrap(array));}}
Output:
java.nio.HeapLongBuffer[pos=0 lim=4 cap=4]
LongBuffer.wrap(long[], int, int)
No comments:
Post a Comment