IntBuffer.wrap(int[]): This method is available in java.nio.IntBuffer class of Java.
Syntax:
IntBuffer java.nio.IntBuffer.wrap(int[] array)
This method takes one argument of type int array as its parameter. This method wraps an int array into a buffer.
Parameters: One parameter is required for this method.
array: The array that will back this buffer.
Returns: The new int buffer.
Exceptions: NA
Approach
Java
import java.nio.IntBuffer;public class IntBufferwrap {public static void main(String[] args) {int array[] = { 1, 2, 3, 4 };System.out.println(IntBuffer.wrap(array));}}
Output:
java.nio.HeapIntBuffer[pos=0 lim=4 cap=4]
No comments:
Post a Comment