IntBuffer rewind() in Java

rewind(): This method is available in java.nio.IntBuffer class of Java.

Syntax:

IntBuffer java.nio.IntBuffer.rewind()

This method rewinds this buffer. The position is set to zero and the mark is discarded.

Parameters: NA

Returns: This buffer.

Exceptions: NA

Approach

Java

import java.nio.IntBuffer;

public class IntBufferrewind {
    public static void main(String[] args) {

        int array[] = { 1, 2, 3, 4 };
        IntBuffer lb = IntBuffer.wrap(array);

        System.out.println(lb.rewind());
    }
}

Output:

java.nio.HeapIntBuffer[pos=0 lim=4 cap=4]


No comments:

Post a Comment